CE_Door GetNextDoor() { if (!nextRoomInvestigate) { return(null); } CE_Door _door = nextRoomInvestigate.GetNearestDoor(this); CE_Door _outDoor = null; if (IsInRoom) { _outDoor = lastRoom.GetNearestDoor(this); transform.position = _outDoor.Position; isInRoom = false; } lastRoom = nextRoomInvestigate; return(_door); }
IEnumerator AIFSM() { currentAIPhase = AIPhase.Idle; if (!nextRoomInvestigate) { nextRoomInvestigate = GetNextRoom(); } if ((!nextDoorTarget)) { nextDoorTarget = GetNextDoor(); } //Debug.Log($"it's my turn {characterRef.ColorName} with {nextRoomInvestigate.RoomName}"); yield return(StartCoroutine(IAMove())); yield return(StartCoroutine(IAEndMove())); yield return(StartCoroutine(IASuggest())); OnEndTurn?.Invoke(); }
IEnumerator IAEndMove() { while (endMoveThinking) { currentAIPhase = AIPhase.RoomEnterThink; if (stepCount < diceCount && CurrentCell == nextDoorTarget.Cell) { endMoveThinking = false; EnterInRoom(); } else { endMoveThinking = false; } yield return(null); } nextDoorTarget = null; IsMoving = false; stepCount = 0; diceCount = 0; iaNavigation.Reset(); }
public void AddDoorLink(CE_Door _door) => roomDoors.Add(_door);