Inheritance: MonoBehaviour
Example #1
0
    public override void Init(int instanceId, int confid, enMSCamp camp)
    {
        base.Init(instanceId, confid, camp);

        ai = new BaseEnemyAI();
        ai.Init(this);
    }
Example #2
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Fish")
     {
         BaseEnemyAI enemy = collision.transform.root.GetComponent <BaseEnemyAI>();
         mobFish.Remove(enemy);
     }
     else if (collision.gameObject.tag == "Player")
     {
         playerFish = null;
     }
 }
Example #3
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Fish")
     {
         BaseEnemyAI enemy = collision.transform.root.GetComponent <BaseEnemyAI>();
         mobFish.Add(enemy);
     }
     else if (collision.tag == "Player")
     {
         PlayerControl player = collision.gameObject.GetComponent <PlayerControl>();
         playerFish = player;
     }
 }
    //---------------------------------------------------------------------------------------------------------------------------------------
    //Methods regarding Assault type missions
    //---------------------------------------------------------------------------------------------------------------------------------------
    /// <summary>
    /// Updates the mission completeness according to the enemy, note that this only works for when the mission is of type Assault.
    /// </summary>
    /// <returns><c>true</c>, if mission was finished, <c>false</c> otherwise(or if it's not a killing enemy dependable mission).</returns>
    public bool UpdateMission(BaseEnemyAI deadEnemy)
    {
        if (missionType != MissionType.Assault || deadEnemy == null)
            return false;

        if (enemiesList.Contains (deadEnemy)) {
            enemiesList.Remove(deadEnemy);
        }

        //All enemies are dead, mission accomplished
        if (enemiesList.Count == 0)
            return true;

        return false;
    }
Example #5
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (IsPoped && collision.gameObject.tag == "Fish")
     {
         BaseEnemyAI enemy = collision.GetComponent <BaseEnemyAI>();
         if (enemy.IsPoped)
         {
             int fishALev = enemy.LevelGap;
             int fishBLev = LevelGap;
             if (fishALev < fishBLev)
             {
                 Destroy(collision.gameObject);
             }
         }
     }
 }
Example #6
0
 public void SetFish(GameObject fish)
 {
     parent = fish.GetComponent <BaseEnemyAI>();
     ((FishAI)parent).SetFishSearcher(this);
 }
    //------------------------------------------------------------------------------------------------------------------------------------
    //Listening related methods(see OnEnable and OnDisable method to check which delegate they are related to)
    //------------------------------------------------------------------------------------------------------------------------------------
    private void EnemySelected(BaseEnemyAI enemy)
    {
        Vector3 newPosition = new Vector3(enemy.transform.position.x, attackSelector.transform.position.y, enemy.transform.position.z);

        attackSelector.transform.SetParent (enemy.transform);

        attackSelector.transform.position = newPosition;
    }
 public void EnemyLeftRange(BaseEnemyAI enemy)
 {
     enemiesInRange.Remove (enemy);
 }
 public void EnemyEnteredRange(BaseEnemyAI enemy)
 {
     if(!enemiesInRange.Contains(enemy))enemiesInRange.Add (enemy);
 }
Example #10
0
 public virtual void AddAI()
 {
     ai = new BaseEnemyAI();
     ai.Init(this);
 }
Example #11
0
 protected override void Awake()
 {
     base.Awake();
     _enemyAI = GetComponent <BaseEnemyAI>();
 }