public void loadResources() { //加载资源 GameObject water = Instantiate(Resources.Load("Prefabs/water", typeof(GameObject)), water_pos, Quaternion.identity, null) as GameObject; water.name = "water"; coast_from = new CoastController(1); coast_to = new CoastController(-1); boat = new BoatController(actionManager); //创建好牧师与恶魔对象,并设置好唯一的名字 for (int i = 0; i < 3; i++) { CharacterController tem = new CharacterController("priest", actionManager); tem.getCharacterModel().setName("priest" + i); tem.getCharacterModel().setPosition(coast_from.getCoastModel().getEmptyPosition()); tem.getOnCoast(coast_from); coast_from.getOnCoast(tem); team.Add(tem); } for (int i = 0; i < 3; i++) { CharacterController tem = new CharacterController("devil", actionManager); tem.getCharacterModel().setName("devil" + i); tem.getCharacterModel().setPosition(coast_from.getCoastModel().getEmptyPosition()); tem.getOnCoast(coast_from); coast_from.getOnCoast(tem); team.Add(tem); } }
public void LoadResources() { fromCoast = new CoastController("from"); toCoast = new CoastController("to"); boat = new BoatController(); judge = new Judge(fromCoast, toCoast, boat); GameObject river = Instantiate(Resources.Load("Prefabs/river", typeof(GameObject)), new Vector3(0, -7, 10), Quaternion.identity, null) as GameObject; river.name = "river"; for (int i = 0; i < 3; i++) { Character p = new Character("priest"); p.setName("priest" + i); p.setPosition(fromCoast.getEmptyPosition()); p.getOnCoast(fromCoast); fromCoast.getOnCoast(p); Character[i] = p; } for (int i = 0; i < 3; i++) { Character d = new Character("devil"); d.setName("devil" + i); d.setPosition(fromCoast.getEmptyPosition()); d.getOnCoast(fromCoast); fromCoast.getOnCoast(d); Character[i + 3] = d; } }
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 LoadResources() { GameObject water = Instantiate(Resources.Load("Prefabs/water", typeof(GameObject))) as GameObject; fromCoast = new CoastController(0, new Vector3(0, 0, 0)); toCoast = new CoastController(1, new Vector3(12, 0, 0)); boat = new BoatController(); characters = new ICharacterController[6]; for (int i = 0; i < 3; i++) { characters[i] = new ICharacterController(i, "priest", new Vector3((float)2.5 - i, (float)1.25, 0)); } for (int i = 3; i < 6; i++) { characters[i] = new ICharacterController(i, "devil", new Vector3((float)2.5 - i, (float)1.25, 0)); } fromCoast.initStorage(characters); /* * Debug.Log("check whether:" + (fromCoast.storage.characterStorage[0] == fromCoast.storage.characterStorage[1])); * for(int i=0;i<6;i++) * { * Debug.Log(fromCoast.storage.characterStorage[i].character.name); * }*/ }
public void loadResources() { GameObject water = Instantiate(Resources.Load("Prefabs/Water", typeof(GameObject)), waterPosititon, Quaternion.identity, null) as GameObject; water.name = "water"; leftCoast = new CoastController("left"); rightCoast = new CoastController("right"); boat = new BoatController(); for (int i = 0; i < 3; i++) { zyzCharacterController newPriest = new zyzCharacterController("priest"); newPriest.setName("priest" + i); newPriest.setPosition(leftCoast.getEmptyPosition()); newPriest.toCoast(leftCoast); leftCoast.toCoast(newPriest); characters[i] = newPriest; } for (int i = 0; i < 3; i++) { zyzCharacterController newDevil = new zyzCharacterController("devil"); newDevil.setName("devil" + i); newDevil.setPosition(leftCoast.getEmptyPosition()); newDevil.toCoast(leftCoast); leftCoast.toCoast(newDevil); characters[i + 3] = newDevil; } }
public void loadResources() { leftCoast = new CoastController("left"); rightCoast = new CoastController("right"); boat = new BoatController(); for (int i = 0; i < 3; i++) { zyzCharacterController newPriest = new zyzCharacterController("priest"); newPriest.setName("priest" + i); newPriest.setPosition(leftCoast.getEmptyPosition()); newPriest.toCoast(leftCoast); leftCoast.toCoast(newPriest); characters[i] = newPriest; } for (int i = 0; i < 3; i++) { zyzCharacterController newDevil = new zyzCharacterController("devil"); newDevil.setName("devil" + i); newDevil.setPosition(leftCoast.getEmptyPosition()); newDevil.toCoast(leftCoast); leftCoast.toCoast(newDevil); characters[i + 3] = newDevil; } }
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() { GameObject river = Instantiate(Resources.Load("Prefabs/river", typeof(GameObject)), river_pos, Quaternion.identity, null) as GameObject; river.name = "river"; right_coast = new CoastController(true); left_coast = new CoastController(false); boat = new BoatController(); for (int i = 0; i < 3; ++i) { characters[i] = new MyCharacterController(true); characters[i].setName("priest" + i); characters[i].setPosition(right_coast.getEmptyPosition(true)); characters[i].getOnCoast(right_coast); right_coast.getOnCoast(characters[i]); } for (int i = 3; i < 6; ++i) { characters[i] = new MyCharacterController(false); characters[i].setName("devil" + i); characters[i].setPosition(right_coast.getEmptyPosition(false)); characters[i].getOnCoast(right_coast); right_coast.getOnCoast(characters[i]); } }
public void loadResources() { GameObject water = Instantiate(Resources.Load("Perfabs/Water", typeof(GameObject)), water_pos, Quaternion.identity, null) as GameObject; water.name = "water"; fromCoast = new CoastController("from", NumDevil + NumPriest); toCoast = new CoastController("to", NumDevil + NumPriest); boat = new BoatController(); for (int i = 0; i < NumPriest; i++) { GenGameObject cha = new GenGameObject("priest"); cha.setName("priest" + i); cha.setPosition(fromCoast.getEmptyPosition()); cha.getOnCoast(fromCoast); fromCoast.getOnCoast(cha); characters[i] = cha; } for (int i = 0; i < NumDevil; i++) { GenGameObject cha = new GenGameObject("devil"); cha.setName("devil" + i); cha.setPosition(fromCoast.getEmptyPosition()); cha.getOnCoast(fromCoast); fromCoast.getOnCoast(cha); characters[i + NumPriest] = cha; } }
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() { 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 LoadResources() { fromCoast = new CoastController("from"); toCoast = new CoastController("to"); boat = new BoatController(); GameObject water = Instantiate(Resources.Load("Perfabs/Water", typeof(GameObject)), new Vector3(0, 0.5F, 0), Quaternion.identity, null) as GameObject; water.name = "water"; for (int i = 0; i < 3; i++) { GameObjects s = new GameObjects("priest"); s.setName("priest" + i); s.setPosition(fromCoast.getEmptyPosition()); s.getOnCoast(fromCoast); fromCoast.getOnCoast(s); GameObjects[i] = s; } for (int i = 0; i < 3; i++) { GameObjects s = new GameObjects("devil"); s.setName("devil" + i); s.setPosition(fromCoast.getEmptyPosition()); s.getOnCoast(fromCoast); fromCoast.getOnCoast(s); GameObjects[i + 3] = s; } }
public void reset() { coastController = (SSDirector.getInstance().currentSceneController as FirstController).fromCoast; getOnCoast(coastController); setPosition(coastController.getEmptyPosition()); coastController.getOnCoast(this); }
public void loadResources() { GameObject water = Instantiate(Resources.Load("Perfabs/Water", typeof(GameObject)), water_pos, Quaternion.identity, null) as GameObject; water.name = "water"; fromCoast = new CoastController(new Vector3(9, 1, 0)); toCoast = new CoastController(new Vector3(-9, 1, 0)); for (int i = 0; i < 6; i++) { MyCharacterController mc; if (i < 3) { mc = new MyCharacterController(CharacterType.Devil); } else { mc = new MyCharacterController(CharacterType.Priest); } characters[i] = mc; var _pos = fromCoast.getEmptyPosition(); mc.setPosition(_pos); mc.getOnCoast(fromCoast.getGameobj(), _pos, CharacterPosition.From); fromCoast.addCharacter(mc); } boat = new BoatController(boatFromPosition, boatToPosition); userGui.state = GameState.NotWin; actionManager = gameObject.AddComponent <CCActionManager>() as CCActionManager; }
//初始化游戏资源,如角色,船等等 public void load() { GameObject water = Instantiate(Resources.Load("Perfabs/water", typeof(GameObject)), water_pos, Quaternion.identity, null) as GameObject; water.name = "water"; leftCoast = new CoastController("left"); rightCoast = new CoastController("right"); boat = new BoatController(); for (int i = 0; i < 3; i++) { MyCharacterController character = new MyCharacterController("priest"); character.setPosition(leftCoast.getEmptyPosition()); character.Oncoast(leftCoast); leftCoast.getOnCoast(character); characters[i] = character; character.setName("priest" + i); } for (int i = 0; i < 3; i++) { MyCharacterController character = new MyCharacterController("devil"); character.setPosition(leftCoast.getEmptyPosition()); character.Oncoast(leftCoast); leftCoast.getOnCoast(character); characters[i + 3] = character; character.setName("devil" + i); } }
public void LoadResources() { SrcCoastController = new CoastController(); SrcCoastController.CreateCoast("src_coast", PositionModel.src_coast); DesCoastController = new CoastController(); DesCoastController.CreateCoast("des_coast", PositionModel.des_coast); boatController = new BoatController(); boatController.CreateBoat(PositionModel.boat_on_left); roleModelControllers = new RoleController[6]; for (int i = 0; i < 3; i++) { roleModelControllers[i] = new RoleController(); roleModelControllers[i].CreateRole(PositionModel.roles[i], 0, i); } for (int i = 3; i < 6; i++) { roleModelControllers[i] = new RoleController(); roleModelControllers[i].CreateRole(PositionModel.roles[i], 1, i); } foreach (RoleController roleModelController in roleModelControllers) { roleModelController.GetRoleModel().role.transform.localPosition = SrcCoastController.AddRole(roleModelController.GetRoleModel()); } moveController = new MoveController(); river = new RiverModel(PositionModel.river); isRuning = true; time = 120; }
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.myAction.GetOnCoast(temp, 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.myAction.GetOnCoast(temp, rightCoastCtrl); //rightCoastCtrl.GetOnCoast(temp); characters[i + 3] = temp; } }
public void loadResources() { GameObject temp = Instantiate(Resources.Load("Perfabs/Water", typeof(GameObject)), waterPosition, Quaternion.identity, null) as GameObject; water = temp; water.name = "water"; startCoast = new CoastController("start", priests + devils); endCoast = new CoastController("end", priests + devils); boat = new BoatController(); for (int i = 0; i < priests; i++) { MyCharacterController Pri = new MyCharacterController(false); Pri.setName("priest" + i); Pri.setPosition(startCoast.getEmptyPosition()); Pri.getOnCoast(startCoast); startCoast.getOnCoast(Pri); characters[i] = Pri; } for (int i = 0; i < devils; i++) { MyCharacterController Dev = new MyCharacterController(true); Dev.setName("devil" + i); Dev.setPosition(startCoast.getEmptyPosition()); Dev.getOnCoast(startCoast); startCoast.getOnCoast(Dev); characters[i + priests] = Dev; } }
public void reset() { coastcontroller = (Director.get_Instance().curren as MySceneController).coast_from; getOnCoast(coastcontroller); charactermodel.setPosition(coastcontroller.getCoastModel().getEmptyPosition()); coastcontroller.getOnCoast(this); }
public void LoadResources() { GameObject water = Instantiate(Resources.Load("Prefabs/WaterProDaytime", typeof(GameObject)), Vector3.zero, Quaternion.identity, null) as GameObject; water.name = "water"; fromCoast = new CoastController("from"); toCoast = new CoastController("to"); boat = new BoatController(); for (int i = 0; i < 3; ++i) { MyCharacterController priest = new MyCharacterController("Priest"); priest.setName("Priest" + i); priest.setPosition(fromCoast.getEmptyPosition()); priest.getOnCoast(fromCoast); fromCoast.getOnCoast(priest); characters[i] = priest; } for (int i = 0; i < 3; ++i) { MyCharacterController devil = new MyCharacterController("Devil"); devil.setName("Devil" + i); devil.setPosition(fromCoast.getEmptyPosition()); devil.getOnCoast(fromCoast); fromCoast.getOnCoast(devil); characters[i + 3] = devil; } }
// 上岸 public void getOnCoast(CoastController coastCtrl, MyCharacterController characterCtrl) { // 人物控制器 characterCtrl.setCoastController(coastCtrl); characterCtrl.setCharacterTransformParent(null);; characterCtrl.setOnBoat(false); }
public void reset() { coast = (Director.getInstace().current as FirstController).fromCoast; getOnCoast(coast); setPos(coast.getEmptyPos()); coast.getOnCoast(this); }
public void loadResources() { GameObject water = Instantiate(Resources.Load("Prefabs/water", typeof(GameObject)), water_pos, Quaternion.identity, null) as GameObject; water.name = "water"; fromCoast = new CoastController("from"); toCoast = new CoastController("to"); boat = new BoatController(); for (int i = 0; i < 3; i++) { MyCharacterController tem = new MyCharacterController("priest"); tem.setName("priest" + i); tem.setPosition(fromCoast.getEmptyPosition()); tem.getOnCoast(fromCoast); fromCoast.getOnCoast(tem); team.Add(tem); } for (int i = 0; i < 3; i++) { MyCharacterController tem = new MyCharacterController("devil"); tem.setName("devil" + i); tem.setPosition(fromCoast.getEmptyPosition()); tem.getOnCoast(fromCoast); fromCoast.getOnCoast(tem); team.Add(tem); } }
public void reset() { moveScript.reset(); coastController = (Director.getInstance().currentSceneController as Controller).startCoast; getOnCoast(coastController); setPosition(coastController.getEmptyPosition()); coastController.getOnCoast(this); }
public void loadResources() { fromCoast = new CoastController("from"); toCoast = new CoastController("to"); boat = new BoatController(); loadCharacter(); }
public void reset() { coastController = (SSDirector.getInstance().currentScenceController as Main).fromCoast; getOnCoast(coastController); setPosition(coastController.getEmptyPosition()); coastController.getOnCoast(this); MovingState = -1; }
public void Reset() { moveableScript.Reset(); coastController = (SSDirector.GetInstance().currentSceneController as FirstController).fromCoast; GetOnCoast(coastController); SetPosition(coastController.GetEmptyPosition()); coastController.GetOnCoast(this); }
public void IsClicked(MyCharacterController characterCtrl) { if (firstActionManager.Complete == SSActionEventType.Started) { return; } if (characterCtrl.IsOnBoat()) { CoastController whichCoast; if (boat.getState() == -1) // to->-1; from->1 { whichCoast = toCoast; } else { whichCoast = fromCoast; } boat.GetOffBoat(characterCtrl.getName()); firstActionManager.MoveCharacter(characterCtrl, whichCoast.getEmptyPosition()); characterCtrl.getOnCoast(whichCoast); whichCoast.getOnCoast(characterCtrl); if (boat.isEmpty()) { gameStatus = 0; // need get on boat } } else // character on coast { CoastController whichCoast = characterCtrl.getCoastController(); if (boat.getEmptyIndex() == -1) // boat is full { gameStatus = 1; return; } if (whichCoast.getState() != boat.getState()) // boat and character are on different side { return; } Debug.Log("get on boat:"); Debug.Log(characterCtrl.getName()); whichCoast.getOffCoast(characterCtrl.getName()); firstActionManager.MoveCharacter(characterCtrl, boat.getEmptyPosition()); characterCtrl.getOnBoat(boat); boat.GetOnBoat(characterCtrl); if (boat.getEmptyIndex() == -1) { gameStatus = 1; // need to move } } userGUI.status = judge.check(fromCoast, toCoast, boat); }
public void LoadResources() { GameObject river = Instantiate(Resources.Load("Perfabs/River", typeof(GameObject)), riverPosition, Quaternion.identity, null) as GameObject; river.name = "river"; fromCoast = new CoastController("from"); toCoast = new CoastController("to"); boat = new BoatController(); LoadCharacter(); }
public void LoadResources( ) { GameObject water = Object.Instantiate(Resources.Load("Prefabs/water", typeof(GameObject)), waterPosition, Quaternion.identity) as GameObject; leftCoast = new CoastController("left"); rightCoast = new CoastController("right"); boat = new BoatController(); Debug.Log("Load water, 2 coasts and a boat"); LoadCharacters(); }