public void CharacterClicked(MySpace.CharacterController characterCtr) { if (userGUI.status == -1 || userGUI.status == 1) { return; } if (characterCtr.character.OnBoat) { CoastController tempCoast = (boatCtr.boat.location == Location.right ? rightCoastCtr : leftCoasrCtr); boatCtr.GetOffBoat(characterCtr.character.Name); characterCtr.MoveTo(tempCoast.GetEmptyPosition()); characterCtr.GetOnCoast(tempCoast); tempCoast.GetOnCoast(characterCtr); } else { CoastController tempCoast = characterCtr.character.coast; if (tempCoast.coast.location != boatCtr.boat.location) { return; //不再同一边的人上不去 } if (boatCtr.GetEmptyIndex() == -1) { return; //船上没人 } tempCoast.GetOffCoast(characterCtr.character.Name); characterCtr.MoveTo(boatCtr.GetEmptyPosition()); characterCtr.GetOnBoat(boatCtr); boatCtr.GetOnBoat(characterCtr); } userGUI.status = CheckGameOver(); }
public void CharacterMove(MySpace.CharacterController characterCtr, Vector3 destination) { Vector3 currentPos = characterCtr.character.Role.transform.position; Vector3 middlePos = currentPos; //终点如果Y坐标小,那么就是上船 //如果大,那么就是下船 if (destination.y > currentPos.y) { middlePos.y = destination.y; } else { middlePos.x = destination.x; } //Debug.Log("current"+currentPos); //Debug.Log("middle"+middlePos); //Debug.Log("destination"+destination); SSAction action1 = CCMoveToAction.GetSSAction(middlePos, characterCtr.character.speed); SSAction action2 = CCMoveToAction.GetSSAction(destination, characterCtr.character.speed); SSAction actions = CCMixedAction.GetSSAction(1, 0, new List <SSAction> { action1, action2 }); AddAction(characterCtr.character.Role, actions, this); }
public void LoadResources() { GameObject river = (new River()).river; rightCoastCtr = new CoastController("right"); leftCoasrCtr = new CoastController("left"); boatCtr = new BoatController(); for (int i = 0; i < 3; ++i) { MySpace.CharacterController temp = new MySpace.CharacterController("Priest" + i); temp.SetPosition(rightCoastCtr.GetEmptyPosition()); temp.GetOnCoast(rightCoastCtr); rightCoastCtr.GetOnCoast(temp); characters[i] = temp; } for (int i = 0; i < 3; ++i) { MySpace.CharacterController temp = new MySpace.CharacterController("Devil" + i); temp.SetPosition(rightCoastCtr.GetEmptyPosition()); temp.GetOnCoast(rightCoastCtr); rightCoastCtr.GetOnCoast(temp); characters[i + 3] = temp; } }
public void CharacterClicked(MySpace.CharacterController characterCtr) { if (judgeCtr.Flag == -1 || judgeCtr.Flag == 1) { return; //lock } if (characterCtr.character.OnBoat) { CoastController tempCoast = (boatCtr.boat.location == Location.right ? rightCoastCtr : leftCoasrCtr); boatCtr.GetOffBoat(characterCtr.character.Name); //characterCtr.MoveTo(tempCoast.GetEmptyPosition()); actionController.CharacterMove(characterCtr, tempCoast.GetEmptyPosition()); characterCtr.GetOnCoast(tempCoast); tempCoast.GetOnCoast(characterCtr); } else { CoastController tempCoast = characterCtr.character.coast; if (tempCoast.coast.location != boatCtr.boat.location) { return; } if (boatCtr.GetEmptyIndex() == -1) { return; } tempCoast.GetOffCoast(characterCtr.character.Name); //characterCtr.MoveTo(boatCtr.GetEmptyPosition()); actionController.CharacterMove(characterCtr, boatCtr.GetEmptyPosition()); //Debug.Log("boat" + boatCtr.GetEmptyPosition()); characterCtr.GetOnBoat(boatCtr); boatCtr.GetOnBoat(characterCtr); } userGUI.status = judgeCtr.judgeGameOver(); }