void ATTile_OnOccupantRemoved(TileMovement occ, ATTile destination) { if (IsDifficultTerrain) { stumblingOcc.Remove(occ); occ.ActorComponent.CharSheet.OnAboutToAttack -= CursedWillPerform; occ.ActorComponent.CharSheet.OnAboutToBeAttacked -= CursedWillBeAttacked; // Debug.LogError ("bla bla"); } //have actors that can see this tile unsee the actor that was removed if they can't see the destination tile and can see enemy. foreach (Actor act in actorsThatSeeThisTile) { Vision eyes = act.GetComponent <Vision> (); if (eyes.CanSee(occ.ActorComponent) && act != occ.ActorComponent) { if (destination == null) //the actor probably died. { Debug.Log("actor: " + eyes.Actor.GetType()); eyes.UndiscoverEnemyActor(occ.ActorComponent); } else if (act.EnemiesWith(occ.ActorComponent)) { if (!destination.actorsThatSeeThisTile.Contains(act)) { eyes.UndiscoverEnemyActor(occ.ActorComponent); } } } } }
void Patrol() { // Do Patrol tf.transform.Rotate(0, 0, -Time.deltaTime * rotationSpeed); if (sense.CanSee(GameManager.instance.player)) { currentState = States.Chase; } }
void ATTile_OnOccupantAdded(TileMovement occ, ATTile previous) { if (IsDifficultTerrain) { stumblingOcc.Add(occ); occ.ActorComponent.CharSheet.OnAboutToAttack += CursedWillPerform; occ.ActorComponent.CharSheet.OnAboutToBeAttacked += CursedWillBeAttacked; } //have actors that can see this tile discover the actor that was added if they don't already see it. foreach (Actor act in actorsThatSeeThisTile) { if (occ.ActorComponent == act) { continue; } Vision eyes = act.GetComponent <Vision> (); if (act.EnemiesWith(occ.ActorComponent) && !eyes.CanSee(occ.ActorComponent)) { eyes.DiscoverEnemyActor(occ.ActorComponent); } } }