Exemple #1
0
    public static TransformFlyAction getAction(Vector3 direction, float speed)
    {
        TransformFlyAction action = CreateInstance <TransformFlyAction>();

        action.direction = direction;
        action.speed     = speed;
        return(action);
    }
    protected new void Start()
    {
        sceneController = Director.getInstance().currentSceneController as FirstSceneController;
        sceneController.ufoActionManager = this;

        slowFlyAction   = TransformFlyAction.getAction(new Vector3(Random.Range(-1, 1f), Random.Range(-1, 1f)), slowSpeed);
        middleFlyAction = TransformFlyAction.getAction(new Vector3(Random.Range(-1, 1f), Random.Range(-1, 1f)), middleSpeed);
        fastFlyAction   = TransformFlyAction.getAction(new Vector3(Random.Range(-1, 1f), Random.Range(-1, 1f)), fastSpeed);
    }
 public void FlyUFO(GameObject ufo, int round)
 {
     if (round == 1)
     {
         slowFlyAction = TransformFlyAction.getAction(new Vector3(Random.Range(-1, 1f), Random.Range(-1, 1f)), slowSpeed);
         this.RunAction(ufo, slowFlyAction, this);
     }
     else if (round == 2)
     {
         middleFlyAction = TransformFlyAction.getAction(new Vector3(Random.Range(-1, 1f), Random.Range(-1, 1f)), middleSpeed);
         this.RunAction(ufo, middleFlyAction, this);
     }
     else if (round == 3)
     {
         fastFlyAction = TransformFlyAction.getAction(new Vector3(Random.Range(-1, 1f), Random.Range(-1, 1f)), fastSpeed);
         this.RunAction(ufo, fastFlyAction, this);
     }
 }