public void NotifyManager(string notifyID, Bounds spriteBounds, SpriteRenderer boxFirstPoint, SpriteRenderer boxSecondPoint) { if (notifyID == "PlayerDestroyEnemy") { for (loopVar1 = 0; loopVar1 < gameEntities.Count; loopVar1++) { if (gameEntities[loopVar1] is IEnemyActor) { tmpEnemy = gameEntities[loopVar1] as IEnemyActor; if (InsideBounds(spriteBounds, tmpEnemy.GetBounds()) && tmpEnemy.BoxFits(spriteBounds)) { //Debug.Log("PLEASE DESTROY SELF"); if (gameEntities[loopVar1] is IColorActor) { if ((gameEntities[loopVar1] as IColorActor).CorrectColor(boxFirstPoint, boxSecondPoint)) { tmpEnemy.DestroySelf("PlayerKill"); } } else { tmpEnemy.DestroySelf("PlayerKill"); } } } } CheckEndLevel(); } }
public override void ActorSpawned(ActorComponent actor) { base.ActorSpawned(actor); this.actor = actor as IEnemyActor; // make sure all the actors are in the idle state when they spawn //CurrentState = FSM.Instance.GetState(this, "idle"); }