public StateClass(PJController pjController, Animator anim, StateMachine sm, string nombre) { this.pjController = pjController; this.anim = anim; this.sm = sm; this.nombre = nombre; }
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"); } }
private void OnCollisionEnter2D(Collision2D collision) { PJController PJ = collision.gameObject.GetComponent <PJController>(); if (PJ.inventario.Tiene("SilverKey")) { Destroy(gameObject); } }
public Idle(PJController pjController, Animator anim, StateMachine sm, string nombre) : base(pjController, anim, sm, nombre) { }
void Start() { _pjController = transform.parent.GetComponent <PJController>(); }