예제 #1
0
 public StateClass(PJController pjController, Animator anim, StateMachine sm, string nombre)
 {
     this.pjController = pjController;
     this.anim         = anim;
     this.sm           = sm;
     this.nombre       = nombre;
 }
예제 #2
0
    public StateMachine(PJController pjController, Animator anim)
    {
        states            = new Dictionary <string, IState>();
        this.pjController = pjController;
        this.anim         = anim;
        facingRight       = true;

        states.Add("Idle", new Idle(pjController, anim, this, "Idle"));
        states.Add("Jump", new Jump(pjController, anim, this, "Jump"));
        states.Add("Crouch", new Crouch(pjController, anim, this, "Crouch"));
        states.Add("Move", new Move(pjController, anim, this, "Move"));
        states.Add("Attack", new Attack(pjController, anim, this, "Attack"));
        states.Add("Fall", new Fall(pjController, anim, this, "Fall"));

        currentlyRunningState = this.states["Fall"];
        ChangeAnimation("Fall");
        previousState = "Fall";
        if (SceneManager.GetActiveScene().buildIndex != 1)
        {
            ChangeAnimation("Idle");
            previousState         = "Idle";
            currentlyRunningState = this.states["Idle"];
            //Corrutina contadora para desactivar pies
            pjController.NoPisoHelper(1.5f);
            FlipX("Left");
        }
    }
예제 #3
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        PJController PJ = collision.gameObject.GetComponent <PJController>();

        if (PJ.inventario.Tiene("SilverKey"))
        {
            Destroy(gameObject);
        }
    }
예제 #4
0
 public Idle(PJController pjController, Animator anim, StateMachine sm, string nombre) :
     base(pjController, anim, sm, nombre)
 {
 }
예제 #5
0
 void Start()
 {
     _pjController = transform.parent.GetComponent <PJController>();
 }