public void PriestGeton() { if (this.state == State.LEFT || this.state == State.RIGHT) { if (getBoatPassenger() != 0) { if (this.state == State.LEFT) { if (priests_left.Count != 0) { GameObject temp = priests_left.Pop(); temp.transform.parent = Boat.transform; if (boatchair[0] == null) { boatchair[0] = temp; BoatFirstClass.x = Boat.transform.position.x - 1; SSActionManager.GetInstance().ApplyCCMoveToYZAction(temp, BoatFirstClass, speed); BoatIdentity[0] = Identity.PRIEST; } else { boatchair[1] = temp; BoatSecondClass.x = Boat.transform.position.x + 1; SSActionManager.GetInstance().ApplyCCMoveToYZAction(temp, BoatSecondClass, speed); BoatIdentity[1] = Identity.PRIEST; } } } else { if (priests_right.Count != 0) { GameObject temp = priests_right.Pop(); temp.transform.parent = Boat.transform; if (boatchair[0] == null) { boatchair[0] = temp; BoatFirstClass.x = Boat.transform.position.x - 1; SSActionManager.GetInstance().ApplyCCMoveToYZAction(temp, BoatFirstClass, speed); BoatIdentity[0] = Identity.PRIEST; } else { boatchair[1] = temp; BoatSecondClass.x = Boat.transform.position.x + 1; SSActionManager.GetInstance().ApplyCCMoveToYZAction(temp, BoatSecondClass, speed); BoatIdentity[1] = Identity.PRIEST; } } } } } }
public void RowingBoat() { if (getBoatPassenger() != 2) { if (this.state == State.LEFT) { SSActionManager.GetInstance().ApplyCCMoveToYZAction(Boat, BoatRightPos, speed); } else if (this.state == State.RIGHT) { SSActionManager.GetInstance().ApplyCCMoveToYZAction(Boat, BoatLeftPos, speed); } } }
// 开船,直接调用SSActionManager中的方法即可 public void moveBoat() { if (boatCapacity() != 2) { if (side == 1) { SSActionManager.GetInstance().ApplyCCMoveToAction(boat_obj, boatEndPos, speed); side = 2; } else if (side == 2) { SSActionManager.GetInstance().ApplyCCMoveToAction(boat_obj, boatStartPos, speed); side = 1; } } }
public void RightGetoff() { if (this.state == State.LEFT || this.state == State.RIGHT) { if (BoatIdentity[1] != Identity.NONE) { if (BoatIdentity[1] == Identity.DEVIL) { if (this.state == State.LEFT) { devils_left.Push(boatchair[1]); Vector3 target = devilLeftPos; target.x = target.x + (3 - devils_left.Count); SSActionManager.GetInstance().ApplyCCMoveToYZAction(boatchair[1], target, speed); } else { devils_right.Push(boatchair[1]); Vector3 target = devilRightPos; target.x = target.x + (3 - devils_right.Count); SSActionManager.GetInstance().ApplyCCMoveToYZAction(boatchair[1], target, speed); } } else { if (this.state == State.LEFT) { priests_left.Push(boatchair[1]); Vector3 target = priestLeftPos; target.x = target.x + (3 - priests_left.Count); SSActionManager.GetInstance().ApplyCCMoveToYZAction(boatchair[1], target, speed); } else { priests_right.Push(boatchair[1]); Vector3 target = priestRightPos; target.x = target.x + (3 - priests_right.Count); SSActionManager.GetInstance().ApplyCCMoveToYZAction(boatchair[1], target, speed); } } boatchair[1].transform.parent = null; boatchair[1] = null; BoatIdentity[1] = Identity.NONE; } } }
// 实现上船动作,在这个过程中牧师或者魔鬼会以transform的形式到达船上 void getOnTheBoat(GameObject obj) { if (boatCapacity() != 0) { obj.transform.parent = boat_obj.transform; Vector3 target = new Vector3(); if (boat[0] == null) { boat[0] = obj; target = boat_obj.transform.position + new Vector3(-0.5f, 0.5f, 0); } else { boat[1] = obj; target = boat_obj.transform.position + new Vector3(0.5f, 0.5f, 0); } SSActionManager.GetInstance().ApplyCCMoveToYZAction(obj, target, speed); } }
public void RunAction(GameObject obj, Vector3 target, float speed, ISSActionCallback monitor) { this.obj = obj; this.target = target; this.speed = speed; this.monitor = monitor; GameSceneController.GetInstance().setMoving(true); if (target.y < obj.transform.position.y) { Vector3 targetZ = new Vector3(target.x, obj.transform.position.y, target.z); SSActionManager.GetInstance().ApplyCCMoveToAction(obj, targetZ, speed, this); } else { Vector3 targetY = new Vector3(target.x, target.y, obj.transform.position.z); SSActionManager.GetInstance().ApplyCCMoveToAction(obj, targetY, speed, this); } }
// 下船,与上船的判断类似 public void getOffTheBoat(int bside) { if (boat[bside] != null) { boat[bside].transform.parent = null; Vector3 target = new Vector3(); if (side == 1) { if (boat[bside].tag == "Priest") { priests_start.Push(boat[bside]); target = getCharacterPosition(priestStartPos, priests_start.Count - 1); } else if (boat[bside].tag == "Devil") { devils_start.Push(boat[bside]); target = getCharacterPosition(devilStartPos, devils_start.Count - 1); } } else if (side == 2) { if (boat[bside].tag == "Priest") { priests_end.Push(boat[bside]); target = getCharacterPosition(priestEndPos, priests_end.Count - 1); } else if (boat[bside].tag == "Devil") { devils_end.Push(boat[bside]); target = getCharacterPosition(devilEndPos, devils_end.Count - 1); } } SSActionManager.GetInstance().ApplyCCMoveToYZAction(boat[bside], target, speed); boat[bside] = null; } }
public void OnActionCompleted(SSAction action) { SSActionManager.GetInstance().ApplyCCMoveToAction(obj, target, speed, null); }
public void ISSActionCallback(SSAction action) { SSActionManager.GetInstance().ApplyCCMoveToAction(obj, target, speed, null); }