public override void Reason(GameObject gm, GameObject npc) { if (npc.GetComponent<ActorFSM>().isHitByLaser()) { npc.GetComponent<ActorFSM>().SetTransition(Transition.LaserCollide); npc.GetComponent<ActorFSM>().setDeathText("laser"); return; } if (gm.GetComponent<GameMasterFSM>().sameTileCollide(npc.gameObject)) { npc.GetComponent<ActorFSM>().SetTransition(Transition.IdleDeath); //to enemyDead } else if (controlref.doneSlide) { int temp = controlref.findNextMove(controlref.direction);//if -1, direction does not change and state stays idle, else update direction if (temp >= 0)//-1 means no move found { controlref.direction = temp; controlref.walk(); npc.GetComponent<ActorFSM>().SetTransition(Transition.FoundMove); //to Look } else { controlref.doneSlide = false; } } }
public override void Reason(GameObject gm, GameObject npc) { if (npc.transform.position.x == controlref.goalPos.x && npc.transform.position.y == controlref.goalPos.y) { if (gm.GetComponent<GameMasterFSM>().sameTileCollide(npc.gameObject)) { npc.GetComponent<ActorFSM>().SetTransition(Transition.EnemyCollide); //to enemyDead return; } else { controlref.doneSlide = false; //do before leaving controlref.transform.parent = gm.GetComponent<GameMasterFSM>().getTile(controlref.transform.position).transform; if (controlref.actorName == "Emily" || controlref.actorName == "Wraith") { if (controlref.visitedWalk == 0) { controlref.visitedWalk++; // can be reworked into transition to idle state. int temp = controlref.findNextMove(controlref.direction);//if -1, direction does not change and state stays idle, else update direction if (temp >= 0) {//-1 means no move found controlref.direction = temp; controlref.walk(); } npc.GetComponent<ActorFSM>().SetTransition(Transition.SecondMove); // } else { controlref.visitedWalk = 0; npc.GetComponent<ActorFSM>().SetTransition(Transition.FinishedWalk); } } else { npc.GetComponent<ActorFSM>().SetTransition(Transition.FinishedWalk); } } } }