public void move() { if (tipFinished) { tipFinished = false; Debug.Log(tipStep); int[] fromCount = scenecontroller.coast_from.getCoastModel().getCharacterNum(); priestNum = fromCount[0]; devilNum = fromCount[1]; BoatCoast = scenecontroller.boat.getModel().getTFflag(); if (tipStep == 0) { nextAction = getNextAction(); if ((int)nextAction >= 3) { chMoveNum = 2; } else if ((int)nextAction > 0) { chMoveNum = 1; } else { chMoveNum = 0; } tipStep++; } Debug.Log("next state is " + nextAction); DoAction(); } }
private BoatAction getNextAction() { Debug.Log("dn" + devilNum + " pn:" + priestNum); BoatAction next = BoatAction.empty; if (BoatCoast == 1) { if (devilNum == 3 && priestNum == 3)//3P3DR { next = BoatAction.PD; } else if (devilNum == 2 && priestNum == 3)//3P2DR { next = BoatAction.DD; } else if (devilNum == 1 && priestNum == 3)//3P1DR { next = BoatAction.PP; } else if (devilNum == 2 && priestNum == 2)//2P2DR { next = BoatAction.PP; } else if (devilNum == 3 && priestNum == 0)//0P3DR { next = BoatAction.DD; } else if (devilNum == 1 && priestNum == 1)//1P1DR { next = BoatAction.PD; } else if (devilNum == 2 && priestNum == 0)//0P2DR { next = BoatAction.D; } else if (devilNum == 1 && priestNum == 2)//2P1DR { next = BoatAction.P; } else if (devilNum == 2 && priestNum == 1)//1P2DR { next = BoatAction.P; } else if (devilNum == 1 && priestNum == 0)//0P1DR { next = BoatAction.D; } else if (devilNum == 3 && priestNum == 2)//2P3DR { next = BoatAction.D; } else { next = BoatAction.empty; } } else { if (devilNum == 2 && priestNum == 2)//2P2DL { next = BoatAction.empty; } else if (devilNum == 1 && priestNum == 3)//3P1DL { next = BoatAction.empty; } else if (devilNum == 2 && priestNum == 3)//3P2DL { next = BoatAction.D; } else if (devilNum == 0 && priestNum == 3)//3P0DL { next = BoatAction.empty; } else if (devilNum == 1 && priestNum == 1)//1P1DL { next = BoatAction.D; } else if (devilNum == 2 && priestNum == 0)//0P2DL { next = BoatAction.D; } else if (devilNum == 1 && priestNum == 0) //0P1DL { next = BoatAction.empty; } else { next = BoatAction.empty; } } return(next); }