Ejemplo n.º 1
0
    // Use to process your families.
    protected override void onProcess(int familiesUpdateCount)
    {
        if (gameData.step)
        {
            foreach (GameObject go in controllableGO)
            {
                if (!ActionManipulator.endOfScript(go))
                {
                    Action action = ActionManipulator.getCurrentAction(go);

                    switch (action.actionType)
                    {
                    case Action.ActionType.Forward:
                        ApplyForward(go);
                        break;

                    case Action.ActionType.TurnLeft:
                        ApplyTurnLeft(go);
                        break;

                    case Action.ActionType.TurnRight:
                        ApplyTurnRight(go);
                        break;

                    case Action.ActionType.Wait:
                        break;

                    case Action.ActionType.Activate:
                        foreach (GameObject actGo in activableGO)
                        {
                            if (actGo.GetComponent <Position>().x == go.GetComponent <Position>().x&& actGo.GetComponent <Position>().z == go.GetComponent <Position>().z)
                            {
                                actGo.GetComponent <AudioSource>().Play();
                                actGo.GetComponent <Activable>().isActivated = true;
                            }
                        }
                        break;
                    }
                    ActionManipulator.incrementActionScript(go.GetComponent <Script>());
                }
            }

            /*foreach( GameObject go in playerGO){
             *      if(ActionManipulator.endOfScript(go)){
             *              ActionManipulator.restartScript(go.GetComponent<Script>());
             *      }
             * }*/
        }
    }