public void MoveCharacter(CharacterController _characterCtrl, Vector3 des) { Vector3 pos = _characterCtrl.getPos(); // Debug.Log (pos); Vector3 mid = pos; if (des.y > pos.y) { mid.y = des.y; } else { mid.x = des.x; } // Debug.Log(mid); // Debug.Log(des); SSAction action1 = CCMoveToActions.GetSSAction(mid, 40); SSAction action2 = CCMoveToActions.GetSSAction(des, 40); SSAction action = CCSequenceAction.GetSSAction(1, 0, new List <SSAction> { action1, action2 }); this.RunAction(_characterCtrl.getGameobj(), action, this); // this.RunAction(_characterCtrl.getGameobj(),action1,this); // this.RunAction (_characterCtrl.getGameobj (), action2, this); }
//人物对象移动 public void GameObjectsMove(GameObjects GameObject, Vector3 Destination) { Complete = SSActionEventType.Started; //防止撞墙,定义一个中点坐标 Vector3 CurrentPos = GameObject.GetPosition(); Vector3 MiddlePos = CurrentPos; if (Destination.y > CurrentPos.y) { MiddlePos.y = Destination.y; } else { MiddlePos.x = Destination.x; } //先移动到中间 SSAction action1 = CCMoveToAction.getAction(MiddlePos, GameObject.GetMoveSpeed()); //在移动到目的地 SSAction action2 = CCMoveToAction.getAction(Destination, GameObject.GetMoveSpeed()); //CCSequenceAction是SSAction的子类 SSAction seqAction = CCSequenceAction.getAction(1, 0, new List <SSAction> { action1, action2 }); //这个类继承了SSActionManager,管理动作 this.addAction(GameObject.GetGameobject(), seqAction, this); }
public void passOffBoatToRight() // 同上 { if (boatSize() != 0) { firstScene.nowStatus = Status.rightoff; int pos = boatSize() - 1; boatPass[pos].transform.parent = null; CCMoveToAction moveA = CCMoveToAction.GetSSAction(Shore.rightShoreside, passSpeed); CCMoveToAction moveB; if (boatPassName[pos] == "devil") { moveB = CCMoveToAction.GetSSAction(Devil.rightFirstPosition + Devil.spaceWithTwo * firstScene.rightDevils.Count, passSpeed); // 右边恶魔的动作 firstScene.rightDevils.Push(boatPass[pos]); // 船上恶魔移动到右岸上 } else { moveB = CCMoveToAction.GetSSAction(Priest.rightFirstPosition + Priest.spaceWithTwo * firstScene.rightPriests.Count, passSpeed); // 右岸牧师的动作 firstScene.rightPriests.Push(boatPass[pos]); // 船上牧师移动到右岸上 } rightPassOffBoat = CCSequenceAction.GetSSAction(new List <SSAction> { moveA, moveB }); this.runAction(boatPass[pos], rightPassOffBoat, this); // 进行动作 boatPass[pos] = null; // 清除船上物体 } }
public void onBoat(GameObject man, int type, int i) { if (type == 1) { Vector3 target1 = man.transform.position + new Vector3(0, 1, 0); CCMoveToAction action1 = CCMoveToAction.GetSSAction(target1, 10f); Vector3 target2 = new Vector3(3, 0.8f, 10) + new Vector3(0.6f * (0 - i), 0, 0); CCMoveToAction action2 = CCMoveToAction.GetSSAction(target2, 10f); List <SSAction> sequence = new List <SSAction>(); sequence.Add(action1); sequence.Add(action2); CCSequenceAction ssaction = CCSequenceAction.GetSSAction(0, sequence); this.RunAction(man, ssaction, this); } else if (type == 0) { Vector3 target1 = man.transform.position + new Vector3(0, 1, 0); CCMoveToAction action1 = CCMoveToAction.GetSSAction(target1, 10f); Vector3 target2 = new Vector3(-3, 0.8f, 10) + new Vector3(0.6f * (0 + i), 0, 0); CCMoveToAction action2 = CCMoveToAction.GetSSAction(target2, 10f); List <SSAction> sequence = new List <SSAction>(); sequence.Add(action1); sequence.Add(action2); CCSequenceAction ssaction = CCSequenceAction.GetSSAction(0, sequence); this.RunAction(man, ssaction, this); } }
public static CCSequenceAction GetSSAction(int start, List <SSAction> sequence) { CCSequenceAction action = ScriptableObject.CreateInstance <CCSequenceAction> (); action.sequence = sequence; action.start = start; return(action); }
public static CCSequenceAction GetSSAction(List <SSAction> _sequence, int _start = 0, int _repeat = 1) { CCSequenceAction actions = ScriptableObject.CreateInstance <CCSequenceAction>(); actions.sequence = _sequence; actions.start = _start; actions.repeat = _repeat; return(actions); }
public void moveRole(GameObject role, Vector3 mid_pos, Vector3 end_pos, float speed) { List <SSAction> list = new List <SSAction>(); list.Add(CCMoveToAction.getSSAction(mid_pos, speed)); list.Add(CCMoveToAction.getSSAction(end_pos, speed)); rolemove = CCSequenceAction.getSSAction(0, 1, list); runAction(role, rolemove, this); }
public static CCSequenceAction getSSAction(int index, int times, List <SSAction> list) { CCSequenceAction action = ScriptableObject.CreateInstance <CCSequenceAction>(); action.index = index; action.times = times; action.act_list = list; return(action); }
public static CCSequenceAction getAction(int repeat, int currentActionIndex, List <SSAction> sequence) { CCSequenceAction action = ScriptableObject.CreateInstance <CCSequenceAction>(); action.sequence = sequence; action.repeat = repeat; action.currentActionIndex = currentActionIndex; return(action); }
public void moveCharacter(GameObject role, Vector3 middle_pos, Vector3 end_pos, float speed) { SSAction action1 = CCMoveToAction.GetSSAction(middle_pos, speed); SSAction action2 = CCMoveToAction.GetSSAction(end_pos, speed); CharaMove = CCSequenceAction.GetSSAction(1, 0, new List <SSAction> { action1, action2 }); this.RunAction(role, CharaMove, this); }
public void moveCharacterAction(GameObject character, Vector3 middle_pos, Vector3 end_pos, float speed) { SSAction action1 = CCMoveToAction.GetSSAction(middle_pos, speed); SSAction action2 = CCMoveToAction.GetSSAction(end_pos, speed); ccmoveCharacter = CCSequenceAction.GetSSAction(1, 0, new List <SSAction> { action1, action2 }); //1表示做一次动作,0表示从初始action1开始 this.RunAction(character, ccmoveCharacter, this); }
public void moveRole(GameObject role, Vector3 middle_pos, Vector3 end_pos, float speed) { SSAction action1 = CCMoveToAction.GetSSAction(middle_pos, speed); SSAction action2 = CCMoveToAction.GetSSAction(end_pos, speed); moveRoleToLandorBoat = CCSequenceAction.GetSSAcition(1, 0, new List <SSAction> { action1, action2 }); this.RunAction(role, moveRoleToLandorBoat, this); }
public static CCSequenceAction GetSSAction(int repeat, int start, List <SSAction> sequence, ISSActionCallback _callback) { CCSequenceAction action = ScriptableObject.CreateInstance <CCSequenceAction>(); action.repeat = repeat; action.sequence = sequence; action.start = start; action.callback = _callback; return(action); }
public void MoveRole(GameObject role, Vector3 middlePosition, Vector3 endPosition, float speed) { SSAction step1 = CCMoveToAction.GetSSAction(middlePosition, speed); SSAction step2 = CCMoveToAction.GetSSAction(endPosition, speed); moveRole = CCSequenceAction.GetSSAction(1, 0, new List <SSAction> { step1, step2 }); this.RunAction(role, moveRole, this); sceneController.moving = true; }
//移动人 public void MoveRole(GameObject role, Vector3 mid_destination, Vector3 destination, int speed) { if (isMoving) { return; } isMoving = true; moveRoleAction = CCSequenceAction.GetSSAction(0, 0, new List <SSAction> { CCMoveToAction.GetSSAction(mid_destination, speed), CCMoveToAction.GetSSAction(destination, speed) }); this.RunAction(role, moveRoleAction, this); }
public void MoveRole(GameObject role, Vector3 transfer, Vector3 target, float speed) { if (isMoving) { return; } isMoving = true; MoveRoleAction = CCSequenceAction.GetSSAction(0, 0, new List <SSAction> { CCMoveToAction.GetSSAction(transfer, speed), CCMoveToAction.GetSSAction(target, speed) }); this.RunAction(role, MoveRoleAction, this); }
public void rightPriestOnBoat() // 同上 { if (boatSize() != 2 && firstScene.rightPriests.Count != 0) // 船上有空位并且有牧师 { firstScene.nowStatus = Status.rightoff; int pos = (boatPass[0] == null ? 0 : 1); // 看要插入的是左还是右 boatPass[pos] = firstScene.rightPriests.Pop(); // 左岸恶魔移动到船上 boatPassName[pos] = "priest"; // 设置姓名 boatPass[pos].transform.parent = firstScene.boat.transform; // 设置关系 CCMoveToAction moveA = CCMoveToAction.GetSSAction(Shore.rightShoreside, passSpeed); CCMoveToAction moveB = CCMoveToAction.GetSSAction(Boat.rightPosition + (pos == 0 ? Boat.leftSeat : Boat.rightSeat), passSpeed); rightPassOnBoat = CCSequenceAction.GetSSAction(new List <SSAction> { moveA, moveB }); this.runAction(boatPass[pos], rightPassOnBoat, this); } }
public void MoveCharacter(CharacterController characterCtrl, Vector3 destination) { Vector3 currentPos = characterCtrl.GetPos(); Vector3 middlePos = currentPos; if (destination.y > currentPos.y) { middlePos.y = destination.y; } else { middlePos.x = destination.x; } SSAction action1 = CCMoveToAction.GetSSAction(middlePos, characterCtrl.speed); SSAction action2 = CCMoveToAction.GetSSAction(destination, characterCtrl.speed); SSAction seqAction = CCSequenceAction.GetSSAction(1, 0, new List <SSAction> { action1, action2 }); this.RunAction(characterCtrl.GetGameobj(), seqAction, this); }
public void moveCharacter(ICharacterController character, Vector3 target) { Vector3 nowPos = character.getPos(); Vector3 tmpPos = nowPos; if (target.y > nowPos.y) { tmpPos.y = target.y; } else { tmpPos.x = target.x; } SSAction action1 = MoveAction.getAction(tmpPos, character.speed); SSAction action2 = MoveAction.getAction(target, character.speed); SSAction sequenceAction = CCSequenceAction.getAction(1, 0, new List <SSAction> { action1, action2 }); this.addAction(character.getInstance(), sequenceAction, this); }
public void move(RoleModel role, Vector3 dest) { Vector3 CurrentPos = role.getRolePos(); Vector3 MiddlePos = CurrentPos; if (dest.y > CurrentPos.y) { MiddlePos.y = dest.y; } else { MiddlePos.x = dest.x; } SSAction action1 = CCMoveToAction.getAction(MiddlePos, role.move_speed); SSAction action2 = CCMoveToAction.getAction(dest, role.move_speed); SSAction seqAction = CCSequenceAction.getAction(1, 0, new List <SSAction> { action1, action2 }); this.addAction(role.getRole(), seqAction, this); }
public void CharacterMove(MyCharacterController GameObject, Vector3 Destination) { Complete = SSActionEventType.started; Vector3 CurrentPos = GameObject.getPosition(); Vector3 MiddlePos = CurrentPos; if (Destination.y > CurrentPos.y) { MiddlePos.y = Destination.y; } else { MiddlePos.x = Destination.x; } SSAction action1 = CCMoveToAction.getAction(MiddlePos, GameObject.getMoveSpeed()); SSAction action2 = CCMoveToAction.getAction(Destination, GameObject.getMoveSpeed()); SSAction seqAction = CCSequenceAction.getAction(1, 0, new List <SSAction> { action1, action2 }); this.addAction(GameObject.getGameObject(), seqAction, this); }
public void MoveCharacter(MyCharacterController character, Vector3 destination) { Complete = SSActionEventType.Started; Vector3 currentPos = character.getPosition(); Vector3 middlePos = currentPos; if (destination.y > currentPos.y) // two step { middlePos.y = destination.y; } else { middlePos.x = destination.x; } SSAction action1 = CCMoveToAction.GetAction(middlePos, character.getSpeed()); SSAction action2 = CCMoveToAction.GetAction(destination, character.getSpeed()); SSAction seqAction = CCSequenceAction.GetAction(1, 0, new List <SSAction> { action1, action2 }); this.addAction(character.getGameobj(), seqAction, this); }
protected new void Start() { object_speed = 4.0f; boat_speed = 4.0f; sceneController = (GenGameObjects)SSDirector.getInstance().currentSceneController; sceneController.actionManager = this; move_up = CCMoveAction.GetSSAction(new Vector3(0, 1, 0), object_speed); move_down = CCMoveAction.GetSSAction(new Vector3(0, -1, 0), object_speed); move_to_boat_left = CCMoveToAction.GetSSAction(new Vector3(-2.3f, 2, 0), object_speed); move_to_boat_right = CCMoveToAction.GetSSAction(new Vector3(-1.2f, 2, 0), object_speed); get_on_boat_left = CCSequenceAction.GetSSAction(0, 0, new List <SSAction> { move_up, move_to_boat_left, move_down }); get_on_boat_right = CCSequenceAction.GetSSAction(0, 0, new List <SSAction> { move_up, move_to_boat_right, move_down }); boat_to_end = CCMoveToAction.GetSSAction(new Vector3(1.7f, 0, 0), boat_speed); boat_to_begin = CCMoveToAction.GetSSAction(new Vector3(-1.7f, 0, 0), boat_speed); }
public void moveCharacter(GameObject chr, Vector3 pos, float speed) { judger.setForbid(true); Vector3 start = chr.transform.position; Vector3 tmp = pos; if (start.y > pos.y) { tmp.y = start.y; } else if (start.y < pos.y) { tmp.x = start.x; } SSAction act1 = SSMoveToAction.GetSSAction(tmp, speed); SSAction act2 = SSMoveToAction.GetSSAction(pos, speed); characterAction = CCSequenceAction.GetSSAcition(1, 0, new List <SSAction> { act1, act2 }); this.RunAction(chr, characterAction, this); }
public void UpDownBoat(Character character, Vector3 destination) { complete = SSActionEventType.Started; Vector3 position = character.gameObject.transform.position; Vector3 middle = position; if (destination.y > position.y) { middle.y = destination.y; } else { middle.x = destination.x; } SSAction action1 = CCMoveToAction.GetAction(middle, character.speed); SSAction action2 = CCMoveToAction.GetAction(destination, character.speed); SSAction sequence = CCSequenceAction.GetAction(1, 0, new List <SSAction> { action1, action2 }); this.AddAction(character.gameObject, sequence, this); }
public void moveCharacter(ChaController characterCtrl, Vector3 destination) { Vector3 halfDest = destination; Vector3 currentPos = characterCtrl.getPosition(); if (destination.y > currentPos.y) { halfDest.x = currentPos.x; } //上船时转折处理 else { halfDest.y = currentPos.y; } SSAction action1 = CCMoveToAction.GetSSAction(halfDest, characterCtrl.Speed); SSAction action2 = CCMoveToAction.GetSSAction(destination, characterCtrl.Speed); SSAction seqAction = CCSequenceAction.GetSSAction(1, 0, new List <SSAction> { action1, action2 }); this.RunAction(characterCtrl.getCharacter(), seqAction, this); }
public void leftDevilOnBoat() // 如果船在左岸边并且人没满,恶魔上船 { if (boatSize() != 2 && firstScene.leftDevils.Count != 0) // 船上有空位并且有恶魔 { firstScene.nowStatus = Status.leftoff; int pos = (boatPass[0] == null ? 0 : 1); // 看要插入的是左还是右 boatPass[pos] = firstScene.leftDevils.Pop(); // 左岸恶魔移动到船上 boatPassName[pos] = "devil"; // 设置姓名 boatPass[pos].transform.parent = firstScene.boat.transform; // 设置关系 CCMoveToAction moveA = CCMoveToAction.GetSSAction(Shore.leftShoreside, passSpeed); CCMoveToAction moveB = CCMoveToAction.GetSSAction(Boat.leftPosition + (pos == 0 ? Boat.leftSeat : Boat.rightSeat), passSpeed); // 设置两个动作 // todo: leftPassOnBoat = CCSequenceAction.GetSSAction(new List <SSAction> { moveA, moveB }); this.runAction(boatPass[pos], leftPassOnBoat, this); // 执行动作 } }
public void MoveDevil(Devil devil) { Vector3 destination = devil.getDestination(); GameObject gameObject = devil.devil; Vector3 startPos = gameObject.transform.position; Vector3 middlePos = destination; if (startPos.y > destination.y) { middlePos.y = startPos.y; } else { middlePos.x = startPos.x; } SSAction action1 = CCMoveToAction.GetSSAction(gameObject, middlePos, AnimateSpeed, null); SSAction action2 = CCMoveToAction.GetSSAction(gameObject, destination, AnimateSpeed, null); CCSequenceAction action = CCSequenceAction.GetSSAction(1, 0, new List <SSAction> { action1, action2 }, this); addAction(action); }
public void moveCharacter(MyCharacterController char0, Vector3 destination) { //Debug.Log("起始位置 " + char0.getGO().transform.position.x + " " + char0.getGO().transform.position.y + " " + char0.getGO().transform.position.z ); //Debug.Log("destination " + destination.x + destination.y + destination.z); Vector3 currentPosition = char0.getGO().transform.position; //这里一定要记录一下, 如果后面每次都取的话,这个是实时变化的 CCMoveToAction move1; CCMoveToAction move2; Vector3 middlePos; if (char0.whetherOnBoat()) //在船上 { middlePos = new Vector3(destination.x, currentPosition.y, currentPosition.z); } else { middlePos = new Vector3(currentPosition.x, destination.y, currentPosition.z); } move1 = CCMoveToAction.GetSSAction(middlePos, 10.0f); move2 = CCMoveToAction.GetSSAction(destination, 10.0f); moveChar = CCSequenceAction.GetSSAction(new List <SSAction> { move1, move2 }, 0, 1); this.RunAction(char0.getGO(), moveChar, this); }