public void LoadResources() { Debug.Log("DD"); GameObject water = Instantiate(Resources.Load("Prefabs/Water", typeof(GameObject)), new Vector3(0, -1, 0), Quaternion.identity) as GameObject; water.name = "water"; start_land = new LandModel("start"); end_land = new LandModel("end"); boat = new BoatModel(); role = new RoleModel[6]; for (int i = 0; i < 3; i++) { RoleModel r = new RoleModel("priest"); r.SetName("priest" + i); r.SetPosition(start_land.GetEmptyPosition()); r.GoLand(start_land); start_land.AddRole(r); role[i] = r; } for (int i = 3; i < 6; i++) { RoleModel r = new RoleModel("devil"); r.SetName("devil" + i); r.SetPosition(start_land.GetEmptyPosition()); r.GoLand(start_land); start_land.AddRole(r); role[i] = r; } }
public void LoadResources() //创建水,陆地,角色,船 { GameObject water = Instantiate(Resources.Load("Water", typeof(GameObject)), new Vector3(0, -6, 0), Quaternion.identity) as GameObject; water.name = "water"; start_land = new LandModel("start"); end_land = new LandModel("end"); boat = new BoatModel(); roles = new RoleModel[6]; for (int i = 0; i < 3; i++) { RoleModel role = new RoleModel("priest"); role.SetName("priest" + i); role.SetPosition(start_land.GetEmptyPosition()); role.GoLand(start_land); start_land.AddRole(role); roles[i] = role; } for (int i = 0; i < 3; i++) { RoleModel role = new RoleModel("devil"); role.SetName("devil" + i); role.SetPosition(start_land.GetEmptyPosition()); role.GoLand(start_land); start_land.AddRole(role); roles[i + 3] = role; } }
public void Reset() { land_model = (SSDirector.GetInstance().CurrentScenceController as Controllor).start_land; GoLand(land_model); SetPosition(land_model.GetEmptyPosition()); land_model.AddRole(this); }
public void MoveRole(RoleModel role) { if (GUI.sign != 0) { return; } if (role.IsOnBoat()) { if (boat.GetBoatSign() == 1) { boat.DeleteRoleByName(role.GetName()); role.Move(startLand.GetEmptyPosition()); role.GetRole().transform.parent = null; role.SetBoat(false); role.SetLand(1); startLand.AddRole(role); //Debug.Log("boat to startt"); } else { boat.DeleteRoleByName(role.GetName()); role.Move(endLand.GetEmptyPosition()); role.GetRole().transform.parent = null; role.SetBoat(false); role.SetLand(-1); endLand.AddRole(role); //Debug.Log("boat to end"); } } else { if (role.GetLand() == 1) { if (boat.GetEmptyNumber() == -1 || startLand.GetLandSign() != boat.GetBoatSign()) { return; } startLand.DeleteRoleByName(role.GetName()); role.Move(boat.GetEmptyPosition()); role.GetRole().transform.parent = boat.GetBoat().transform; role.SetBoat(true); boat.AddRole(role); //Debug.Log("start to boat"); } else { if (boat.GetEmptyNumber() == -1 || endLand.GetLandSign() != boat.GetBoatSign()) { return; } endLand.DeleteRoleByName(role.GetName()); role.Move(boat.GetEmptyPosition()); role.GetRole().transform.parent = boat.GetBoat().transform; role.SetBoat(true); boat.AddRole(role); //Debug.Log("end to boat"); } } GUI.sign = Check(); }
public void MoveRole(RoleModel role) { if (GUI.sign != 0) { return; } Vector3 middlePos, endPos; if (role.IsOnBoat()) { if (boat.GetBoatSign() == 1) { boat.DeleteRoleByName(role.GetName()); endPos = startLand.GetEmptyPosition(); role.SetLand(1); startLand.AddRole(role); } else { boat.DeleteRoleByName(role.GetName()); endPos = endLand.GetEmptyPosition(); role.SetLand(-1); endLand.AddRole(role); } middlePos = new Vector3(role.GetGameObject().transform.position.x, endPos.y, endPos.z); actionManager.moveRole(role.GetGameObject(), middlePos, endPos, role.roleSpeed); role.GetGameObject().transform.parent = null; role.SetBoat(false); } else { if (role.GetLand() == 1) { if (boat.GetEmptyNumber() == -1 || startLand.GetLandSign() != boat.GetBoatSign()) { return; } startLand.DeleteRoleByName(role.GetName()); } else { if (boat.GetEmptyNumber() == -1 || endLand.GetLandSign() != boat.GetBoatSign()) { return; } endLand.DeleteRoleByName(role.GetName()); } endPos = boat.GetEmptyPosition(); middlePos = new Vector3(endPos.x, role.GetGameObject().transform.position.y, endPos.z); actionManager.moveRole(role.GetGameObject(), middlePos, endPos, role.roleSpeed); role.GetGameObject().transform.parent = boat.GetGameObject().transform; role.SetBoat(true); boat.AddRole(role); } GUI.sign = gameStatusManager.CheckGame(); }
public void LoadResources() { water = new Water(); startLand = new LandModel("start"); endLand = new LandModel("end"); boat = new BoatModel(); roles = new RoleModel[6]; for (int i = 0; i < 3; i++) { RoleModel role = new RoleModel("priest", startLand.GetEmptyPosition()); role.SetName("priest" + i); startLand.AddRole(role); roles[i] = role; } for (int i = 0; i < 3; i++) { RoleModel role = new RoleModel("devil", startLand.GetEmptyPosition()); role.SetName("devil" + i); startLand.AddRole(role); roles[i + 3] = role; } }