using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HoneyJar : MonoBehaviour {
    public GameManager gm;
    public Rigidbody2D rb;
    // Use this for initialization
    void Start () {
        rb = GetComponent<Rigidbody2D>();
        gm.StartingHoneyJarPosition = transform.position;
        gm.StartingHoneyJarRotation = transform.rotation;
	}
	
	// Update is called once per frame
	void Update () {
		
	}

    public void Hit(bool isLeftSideHit, float force, string insect)
    {
        gm.am.PlayClip("Glass Ping");

        if (!isLeftSideHit)
            force = force * -1;

        rb.AddForce(transform.right * force);

        switch(insect)
        {
            case "Bee":
                gm.sm.addPlayerHit();
                return;
            case "Fly":
                gm.sm.addEnemyHit();
                return;
            default:
                Debug.Log("Unknown insect!");
                return;
        }
    }
}
