示例#1
0
 private void Update()
 {
     boundary = Mathf.Abs(GetComponent <Transform>().position.x);
     if (boundary > 11)
     {
         Destroy(gameObject);
         SpawnMob.mobDestroy();
     }
 }
示例#2
0
    public void Damage(int damageCount)
    {
        hp -= damageCount;

        /*
         * MonsterMove damage = new MonsterMove();
         * damage.damage(damageCount);
         */

        GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 500f));


        if (hp <= 0)
        {
            Destroy(gameObject);
            SpawnMob.mobDestroy();
        }
    }