public void SetBounce() { if (CurrentSpecialState == SpecialState.None) { SoundsManager.getInstance().PlayBounceEffect(); CurrentSpecialState = SpecialState.Bounce; transform.GetChild(5).gameObject.SetActive(true); Invoke("CureBounce", StatusDuration); } }
public void SetConfused() { if (CurrentSpecialState == SpecialState.None) { SoundsManager.getInstance().PlayConfusedEffect(); CurrentSpecialState = SpecialState.Confused; transform.GetChild(4).gameObject.SetActive(true); Invoke("CureConfused", StatusDuration); } }
public void SetFrozen() { if (CurrentSpecialState == SpecialState.None) { SoundsManager.getInstance().PlayFrozenEffect(); CurrentSpecialState = SpecialState.Frozen; transform.GetChild(3).gameObject.SetActive(true); Invoke("CureFrozen", StatusDuration); } }
protected override void Awake() { stateMachine = new StateMachine(); attackState = new AttackState(AttackStateCond, () => { atacking = true; }, () => { atacking = false; }, this, gameObject, stateMachine, "Attack"); idleState = new IdleState(IdleStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Idle"); runState = new RunState(RunStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Run"); specialState = new SpecialState(SpecialStateCond, OnEnterSpecialState, () => { coolDownSpecialTimer = 0f; cooldown = 0f; specialCond = false; canBeHit = true; coolDownTimer = 0f; }, this, gameObject, stateMachine, "Special"); deathState = new DeathState(DeathStateCond, () => { dead = true; GetComponent <BoxCollider2D>().enabled = false; StartCoroutine(Pause(.1f)); StartCoroutine(WaitToDie(6f)); }, () => {}, this, gameObject, stateMachine, "Death"); playerTransform = GameObject.FindWithTag("Player").transform; healthBoss = GameObject.Find("HealthBoss"); health = maxHealth; healthBoss.GetComponent <HealthBar>().SetMaxHealth(maxHealth); healthBoss.GetComponent <HealthBar>().SetHealth(health); }
void Awake() { stateMachine = new StateMachine(); attackState = new AttackState(AttackStateCond, () => { atacking = true; }, () => { atacking = false; }, this, gameObject, stateMachine, "Attack"); idleState = new IdleState(IdleStateCond, () => StartCoroutine(WaitToLeaveIdle(idleTime)), () => {}, this, gameObject, stateMachine, "Idle"); runState = new RunState(RunStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Run"); jumpState = new JumpState(JumpStateCond, () => { if (velocity.y > 0) { jumping = true; } }, () => jumping = false, this, gameObject, stateMachine, "Jump"); specialState = new SpecialState(SpecialStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Special"); deathState = new DeathState(DeathStateCond, () => { dead = true; GetComponent <BoxCollider2D>().enabled = false; StartCoroutine(Pause(.1f)); StartCoroutine(WaitToDie(6f)); }, () => {}, this, gameObject, stateMachine, "Death"); }
void Awake() { coolDownTimer = attackCoolDownMax; stateMachine = new StateMachine(); attackState = new AttackState(AttackStateCond, () => { atacking = true; }, () => { atacking = false; if (isOnFloor) { velocityXSmoothing = 0; targetVelocityX = 0; velocity.x = 0; } }, this, gameObject, stateMachine, "Attack"); idleState = new IdleState(IdleStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Idle"); runState = new RunState(RunStateCond, () => { footDust.Play(); }, () => { footDust.Stop(); }, this, gameObject, stateMachine, "Run"); jumpState = new JumpState(JumpStateCond, () => { if (velocity.y > 0) { jumping = true; } }, () => { jumping = false; jumpDust.Play(); }, this, gameObject, stateMachine, "Jump"); specialState = new SpecialState(SpecialStateCond, () => { specialCond = false; }, () => {}, this, gameObject, stateMachine, "Special"); deathState = new DeathState(DeathStateCond, () => { GetComponent <BoxCollider2D>().enabled = false; StartCoroutine(Pause(.3f)); StartCoroutine(WaitToDie(2f)); }, () => {}, this, gameObject, stateMachine, "Death"); }
public ChessMove( ChessBoard board, ChessPiece movingPiece, ChessTile?origin, ChessTile?destination, SpecialState state = SpecialState.None, ChessPiece secondaryPiece = null, ChessTile?secondaryOrigin = null, ChessTile?secondaryDestination = null, SpecialState secondaryState = SpecialState.None) { Board = board; MoveDate = Board.MoveHistory.Count; Piece[0] = movingPiece; Origin[0] = origin; Destination[0] = destination; State[0] = state; Piece[1] = secondaryPiece; Origin[1] = secondaryOrigin; Destination[1] = secondaryDestination; State[1] = secondaryState; }
void Awake() { stateMachine = new StateMachine(); attackState = new AttackState(AttackStateCond, () => { atacking = true; oldFacingDirection = FacingDirection; }, () => { atacking = false; if (isOnFloor) { velocityXSmoothing = 0; targetVelocityX = 0; velocity.x = 0; } }, this, gameObject, stateMachine, "Attack"); idleState = new IdleState(IdleStateCond, () => {}, () => {}, this, gameObject, stateMachine, "Idle"); runState = new RunState(RunStateCond, () => { footDust.Play(); }, () => { footDust.Stop(); }, this, gameObject, stateMachine, "Run"); jumpState = new JumpState(JumpStateCond, () => { if (velocity.y > 0) { jumping = true; } }, () => { jumping = false; if (isOnFloor) { jumpDust.Play(); landSound.pitch = Random.Range(.8f, .9f); landSound.Play(); } }, this, gameObject, stateMachine, "Jump"); specialState = new SpecialState(SpecialStateCond, OnEnterSpecialState, OnExitSpecialState, this, gameObject, stateMachine, "Special"); deathState = new DeathState(DeathStateCond, () => { GetComponent <BoxCollider2D>().enabled = false; StartCoroutine(Pause(.3f)); StartCoroutine(WaitToDie(2f)); }, () => {}, this, gameObject, stateMachine, "Death"); }
void CureBounce() { CurrentSpecialState = SpecialState.None; transform.GetChild(5).gameObject.SetActive(false); }
void CureConfused() { CurrentSpecialState = SpecialState.None; transform.GetChild(4).gameObject.SetActive(false); }
void CureFrozen() { CurrentSpecialState = SpecialState.None; transform.GetChild(3).gameObject.SetActive(false); }