Esempio n. 1
0
    private void Start()
    {
        // Set layers to analyse collisions
        groundlayers = GetComponent <PlatformerMotor2D>().staticEnvLayerMask;

        // Initializing two actual states
        idleState   = new Idle();
        patrolState = new Patrol();
        runState    = new Run();

        // Adding them to our state list
        states.Add(idleState);
        states.Add(patrolState);
        states.Add(runState);

        // Set states's gameobject reference, aka initialize (again...)
        InitializeStates();

        // Scan enviroment to set patrolState constrains
        patrolState.PrepareForPatroling();

        // Stay in idle officially
        EnterState(idleState);
    }