public void CharacterClicked(MyNamespace.CharacterController characterCtrl) { if (characterCtrl.character.IsOnBoat) { CoastController tempCoast = (boatCtrl.boat.Location == Location.right ? rightCoastCtrl : leftCoastCtrl); boatCtrl.GetOffBoat(characterCtrl.character.Name); actionManager.MoveCharacter(characterCtrl, tempCoast.GetEmptyPosition()); characterCtrl.GetOnCoast(tempCoast); tempCoast.GetOnCoast(characterCtrl); } else { CoastController tempCoast = characterCtrl.character.Coast; if (tempCoast.coast.Location != boatCtrl.boat.Location) { return; // Boat at another side } if (boatCtrl.GetEmptyIndex() == -1) { return; // Boat is full } tempCoast.GetOffCoast(characterCtrl.character.Name); actionManager.MoveCharacter(characterCtrl, boatCtrl.GetEmptyPosition()); characterCtrl.GetOnBoat(boatCtrl); boatCtrl.GetOnBoat(characterCtrl); } UserGUI.status = CheckGameOver(); }
public void LoadResources() { terrainPos = new Vector3(-100, -7, -100); Terrain terrain = Instantiate(Resources.Load("Prefab/Terrain", typeof(Terrain)), terrainPos, Quaternion.identity, null) as Terrain; terrain.name = "terrain"; rightCoastCtrl = new CoastController("right"); leftCoastCtrl = new CoastController("left"); boatCtrl = new BoatController(); for (int i = 0; i < 3; ++i) { MyNamespace.CharacterController temp = new MyNamespace.CharacterController("priest" + i); temp.SetPosition(rightCoastCtrl.GetEmptyPosition()); temp.GetOnCoast(rightCoastCtrl); rightCoastCtrl.GetOnCoast(temp); characters[i] = temp; } for (int i = 0; i < 3; ++i) { MyNamespace.CharacterController temp = new MyNamespace.CharacterController("devil" + i); temp.SetPosition(rightCoastCtrl.GetEmptyPosition()); temp.GetOnCoast(rightCoastCtrl); rightCoastCtrl.GetOnCoast(temp); characters[i + 3] = temp; } }
public void LoadResources() { riverPos = new Vector3(0, 0.5f, 0); GameObject river = Instantiate(Resources.Load("Prefab/Water", typeof(GameObject)), riverPos, Quaternion.identity, null) as GameObject; river.name = "river"; rightCoastCtrl = new CoastController("right"); leftCoastCtrl = new CoastController("left"); boatCtrl = new BoatController(); for (int i = 0; i < 3; ++i) { MyNamespace.CharacterController temp = new MyNamespace.CharacterController("priest" + i); temp.SetPosition(rightCoastCtrl.GetEmptyPosition()); temp.GetOnCoast(rightCoastCtrl); rightCoastCtrl.GetOnCoast(temp); characters[i] = temp; } for (int i = 0; i < 3; ++i) { MyNamespace.CharacterController temp = new MyNamespace.CharacterController("devil" + i); temp.SetPosition(rightCoastCtrl.GetEmptyPosition()); temp.GetOnCoast(rightCoastCtrl); rightCoastCtrl.GetOnCoast(temp); characters[i + 3] = temp; } }