// ApplyMoveToAction public U3dAction ApplyMoveToAction(GameObject obj, Vector3 target, float speed, IU3dActionCompleted completed) { MoveToAction ac = obj.AddComponent <MoveToAction>(); ac.setting(target, speed, completed); return(ac); }
public static MoveToAction getAction(Vector3 target, float speed) { MoveToAction action = ScriptableObject.CreateInstance <MoveToAction>(); action.target = target; action.speed = speed; return(action); }
public void moveCharacter(MyCharactorController characterCtrl, Vector3 destination) { Vector3 currentPos = characterCtrl.getPos(); Vector3 middlePos = currentPos; if (destination.y > currentPos.y) //from low(boat) to high(coast) { middlePos.y = destination.y; } else //from high(coast) to low(boat) { middlePos.x = destination.x; } ObjAction action1 = MoveToAction.getAction(middlePos, characterCtrl.movingSpeed); ObjAction action2 = MoveToAction.getAction(destination, characterCtrl.movingSpeed); ObjAction seqAction = SequenceAction.getAction(1, 0, new List <ObjAction> { action1, action2 }); this.addAction(characterCtrl.getGameobj(), seqAction, this); }
public U3dAciton ApplyMoveToAction(GameObject obj) { MoveToAction ac = obj.AddComponent <MoveToAction>(); return(ac); }
public void moveBoat(BoatController boat) { MoveToAction action = MoveToAction.getAction(boat.getDestination(), boat.movingSpeed); this.addAction(boat.getGameobj(), action, this); }