public void MoveBoat(int from_to) { if (!movable) { return; } sceneController = Controller.Director.getInstance().currentSceneController as Controller.Scene.SceneController_1; if (sceneController.boat.isEmpty()) //船上无人,不能移动 { return; } sceneController.boat.Move(); CCAction_DirectMoveTo temp_action; if (from_to == -1) { temp_action = CCAction_DirectMoveTo.GetAction(fromPosition, 3); RunAction(sceneController.boat.getGameobj(), temp_action, this); } else { temp_action = CCAction_DirectMoveTo.GetAction(toPosition, 3); RunAction(sceneController.boat.getGameobj(), temp_action, this); } sceneController.SetGameState(sceneController.check_game_over()); }
public static CCAction_DirectMoveTo GetAction(Vector3 target, float speed) { CCAction_DirectMoveTo action = ScriptableObject.CreateInstance <CCAction_DirectMoveTo>(); action.target = target; action.speed = speed; return(action); }