Exemplo n.º 1
0
    void Start()
    {
        m_rigidBody = GetComponent <OneBody2D> ();
        m_animator  = GetComponent <Animator> ();

        // State table
        m_ActorStateTable = new ActorState[(int)State.Count];

        // Try the children (in the case of the player using a proxy)
        if (m_animator == null)
        {
            Component[] components = transform.GetComponentsInChildren <Animator>();

            if (components.Length > 0)
            {
                m_animator = components[0] as Animator;
            }
        }

        m_startingPosition = transform.position;

        // Create states
        m_ActorStateTable[(int)State.Stand]      = new ActorState_Stand(this);
        m_ActorStateTable[(int)State.Walk]       = new ActorState_Stand(this);   //Repeat for now
        m_ActorStateTable[(int)State.Jump]       = new ActorState_Jump(this);
        m_ActorStateTable[(int)State.HangJump]   = new ActorState_HangJump(this);
        m_ActorStateTable[(int)State.WallJump]   = new ActorState_WallJump(this);
        m_ActorStateTable[(int)State.DoubleJump] = new ActorState_DoubleJump(this);
        m_ActorStateTable[(int)State.Fall]       = new ActorState_Fall(this);
        m_ActorStateTable[(int)State.Attack]     = new ActorState_Attack(this);
        m_ActorStateTable[(int)State.WallSlide]  = new ActorState_WallSlide(this);
        m_ActorStateTable[(int)State.LedgeGrab]  = new ActorState_LedgeGrab(this);

        Reset();
    }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     waitTime          = Random.Range(0, 3);
     m_actorController = GetComponent <ActorController> ();
     m_RigidBody       = GetComponent <OneBody2D> ();
 }
Exemplo n.º 3
0
 public ActorState(ActorController parent)
 {
     m_parent    = parent;
     m_rigidBody = m_parent.rigidBody;
     m_animator  = m_parent.animator;
 }