示例#1
0
   new void Start() {
      base.Start();
      health = enemy.maxHealth;
      mode = EnemyActionMode.Patrol;

      attackTimer = 0.0f;

      animationController = GetComponentInChildren<SnakeAnimationController>();
   }
示例#2
0
   // Won't work if the player is already in the trigger area
   void OnTriggerEnter2D(Collider2D other) {
      if (other.tag == "Player") {
         target = other.GetComponent<Player>();
         mode = EnemyActionMode.Aggressive;

         // Cheap trick to ignore collision between player and enemy
         Physics2D.IgnoreCollision(GetComponent<BoxCollider2D>(), other.GetComponent<BoxCollider2D>());
         Physics2D.IgnoreCollision(GetComponent<BoxCollider2D>(), other.GetComponent<CircleCollider2D>());
      }
   }
示例#3
0
    new void Start()
    {
        //base.Start();
        health = enemy.maxHealth;
        mode   = EnemyActionMode.Patrol;

        projectileInstance = Instantiate <GameObject>(enemy.projectileObject);
        projectileInstance.GetComponent <Projectile>().SetOwner(enemy);

        projectileInstance.SetActive(false);
    }