Esempio n. 1
0
    //	void OnCollisionEnter2D (Collision2D collision)
    void OnTriggerEnter2D(Collider2D collider)
    {
        Debug.Log("OnCollisionEnter2D : " + collider.gameObject.name + ", " + collider.gameObject.tag);
        if (collider.gameObject.tag == "PlayerShoot")
        {
            ShootMovement data = (ShootMovement)collider.gameObject.GetComponent(typeof(ShootMovement));

            m_fEnege -= data.getPower();

            if (m_fEnege < 0)
            {
                EnemyMovement movement = GetComponent <EnemyMovement>();
                movement.m_fSpeed = 2.0f;

                m_anim.SetBool("isDestroy", true);
                this.tag = "Untagged";
            }
            else
            {
                data.actionDestroy();
            }
        }
    }
Esempio n. 2
0
 private void Awake()
 {
     shootMov = FindObjectOfType <ShootMovement>();
 }