// 移动船只。 public void MoveBoat(BoatController boat) { // 创建船的直线运动。 MoveToAction action = MoveToAction.GetAction(boat.gameObject, this, boat.GetDestination(), 20); AddAction(action); }
// It is called when a character goes aboard. public void GoAboard(BoatController boat) { location = boat.location; model.isOnboard = true; transform.parent = boat.transform; SetDestination(boat.model.GetEmptyPosition()); boat.GoAboard(this); }
// It generates the GameObjects. private void GenGameObjects() { // Load River. { GameObject temp = Utils.Instantiate("Prefabs/Water", new Vector3(0, 0.5f, 0)); temp.name = "River"; } // Load LeftCoast. { GameObject temp = Utils.Instantiate("Prefabs/Stone", Coast.departure); leftCoast = temp.AddComponent <CoastController>(); temp.name = leftCoast.name = "LeftCoast"; leftCoast.location = Location.Left; } // Load RightCoast. { GameObject temp = Utils.Instantiate("Prefabs/Stone", Coast.destination); rightCoast = temp.AddComponent <CoastController>(); temp.name = rightCoast.name = "RightCoast"; rightCoast.location = Location.Right; } // Load Boat. { GameObject temp = Utils.Instantiate("Prefabs/Boat", Boat.departure); boat = temp.AddComponent <BoatController>(); temp.name = boat.name = "Boat"; } // Load Priests. for (int i = 0; i < 3; ++i) { GameObject temp = Utils.Instantiate("Prefabs/Priest", Coast.destination); characters[i] = temp.AddComponent <CharacterController>(); temp.name = characters[i].name = "Priest" + i; characters[i].GoAshore(rightCoast); } // Load Devils. for (int i = 0; i < 3; ++i) { GameObject temp = Utils.Instantiate("Prefabs/Devil", Coast.destination); characters[i + 3] = temp.AddComponent <CharacterController>(); temp.name = characters[i + 3].name = "Devil" + i; characters[i + 3].GoAshore(rightCoast); } }