public override void IsChanging(PlayerStateEntry upperState) { if (!status.GetRunButton()) { upperState.ChangeState(waiting); } }
public override void Enter(PlayerStateEntry upperState) { anim.SetBool("CliffHold", true); cliffHoldingCommand.Enter(); jumpOff = false; jumpOn = false; }
public override void Exit(PlayerStateEntry upperState) { anim.SetBool("WallJumpRight", false); anim.SetBool("WallJumpLeft", false); anim.SetBool("JumpOfTop", true); wallJumpingCommand.Exit(); }
public override void IsChanging(PlayerStateEntry upperState) { if (status.GetIsGrounded()) { upperState.ChangeState(moving); } }
public override void Enter(PlayerStateEntry upperState) { anim.SetBool("JumpToTop", true); jumpingNextTimer = 0; jumpingFirstCommand.Enter(); GameDirector.Instance().audioDirector.PlaySE("jump", 3); }
//状態遷移関数 public override void ChangeState(PlayerStateEntry se) { currentState.Exit(this); preState = currentState; currentState = se; currentState.Enter(this); }
public override void Enter(PlayerStateEntry upperState) { firstTimer = 0; curWallJumped = status.GetWallJumped(); preWallJumped = curWallJumped; wallJumped = false; wallJumpingCommand.Enter(); GameDirector.Instance().audioDirector.PlaySE("jump", 3); }
public override void Exit(PlayerStateEntry upperState) { currentState.Exit(this); //アニメーション処理 if (currentState == wallJumping) { anim.SetBool("JumpOfTop", false); } }
public override void IsChanging(PlayerStateEntry se) { AnimatorStateInfo info = anim.GetCurrentAnimatorStateInfo(0); float currentAnimTime = info.normalizedTime; if (Input.GetButtonDown("Attack") && info.IsName("Attack2")) { se.ChangeState(attackingThird); } }
public override void IsChanging(PlayerStateEntry upperState) { if (status.GetWallJumped()) { upperState.ChangeState(wallJumping); } else if (status.GetCliffHeld()) { upperState.ChangeState(cliffHolding); } }
public override void Enter(PlayerStateEntry upperState) { if (upperState.GetPreState() == jumping) { currentState = attackingInAir; } else { currentState = attackingFirst; } currentState.Enter(this); }
public override void IsChanging(PlayerStateEntry upperState) { if (status.GetDamaged()) { upperState.ChangeState(damaging); //waitingTimerがあるのはすぐにwaitingに移ってしまうため } else if (status.GetIsGrounded() && waitingTimer > thresholdTime) { upperState.ChangeState(moving); } }
public override void Enter(PlayerStateEntry upperState) { if (status.GetDead()) { currentState = dying; } else { currentState = nockBacking; } currentState.Enter(this); }
private bool useWarp; //カメラをワープ移動させるか //初期化関数 void Start() { type = DirectorType.Character; stateMachine = GetComponent <PlayerStateMachine>(); weaponStateMachine = GetComponentInChildren <WeaponStateMachine>(); charCon = GetComponent <CharacterController>(); status = GetComponent <PlayerStatus>(); baseObserver = new List <BaseObserver>(); anim = GetComponent <Animator>(); nUW = false; initialized = false; obCamera = GetComponent <SlideMoveCamera>(); useWarp = false; }
public override void IsChanging(PlayerStateEntry upperState) { AnimatorStateInfo info = anim.GetCurrentAnimatorStateInfo(0); float currentDamagedTime = info.normalizedTime; bool curNockBack = (currentState == nockBacking); if (currentDamagedTime >= 0.5f && status.GetIsGrounded()) { if (info.IsTag("NockBack")) { status.SetDamaged(false); upperState.ChangeState(moving); } } }
public override void IsChanging(PlayerStateEntry upperState) { AnimatorStateInfo info = anim.GetCurrentAnimatorStateInfo(0); float endTime = info.normalizedTime; if (status.GetDamaged()) { upperState.ChangeState(damaging); } else if (endTime >= 0.65f && (info.IsName("Attack1") || info.IsName("Attack2") || info.IsName("Attack3"))) { upperState.ChangeState(upperState.GetPreState()); } }
public override void IsChanging(PlayerStateEntry upperState) { if (jumpOff) //下に落ちるなら { upperState.ChangeState(jumpingWithUpToDown); } else if (curCliffHeld && !preCliffHeld) //このステートの中で崖つかまりした瞬間 { upperState.ChangeState(cliffHolding); } else if (!curCliffHeld && preCliffHeld && !jumpOn) //離れた瞬間 { upperState.ChangeState(jumpingWithUpToDown); } }
public override void Enter(PlayerStateEntry upperState) { //if (status.GetSlideButton()) { // currentState = slideJumping; /*} else*/ if (status.GetJumpButton()) { currentState = jumpingFirst; } else { currentState = jumpingWithUpToDown; } currentState.Enter(this); preState = currentState; waitingTimer = 0; }
public override void IsChanging(PlayerStateEntry upperState) { if (status.GetDamaged()) { upperState.ChangeState(damaging); } else if (status.GetJumpButtonDown()) { upperState.ChangeState(jumping); } else if (status.GetAttackButtonDown()) { upperState.ChangeState(attacking); } else if (status.GetJumpingOff()) { upperState.ChangeState(jumping); } }
public override void IsChanging(PlayerStateEntry upperState) { if (status.GetJumpButtonDown() && jumpingNextTimer > thresholdTime) { upperState.ChangeState(jumpingSecond); } else if (status.GetWallJumped()) { upperState.ChangeState(wallJumping); } else if (status.GetCliffHeld()) { upperState.ChangeState(cliffHolding); } else if (status.GetMaxJumped() && jumpingNextTimer > thresholdTime) { upperState.ChangeState(jumpingWithUpToDown); } }
public override void IsChanging(PlayerStateEntry upperState) { if (status.GetCliffHeld()) { upperState.ChangeState(cliffHolding); } //次の壁についた瞬間 else if (!preWallJumped && curWallJumped) { upperState.ChangeState(wallJumping); } //ジャンプが最大距離に達していて、ジャンプした後の時間が閾値を超えたら else if (status.GetMaxJumped() && firstTimer > thresholdTime) { upperState.ChangeState(jumpingWithUpToDown); } else if (status.GetIsNearForWallJumped()) { upperState.ChangeState(jumpingWithUpToDown); } }
public override void Enter(PlayerStateEntry upperState) { }
public override void Exit(PlayerStateEntry upperState) { anim.SetBool("Running", false); }
public override void Enter(PlayerStateEntry upperState) { anim.SetBool("Running", true); runningCommand.Enter(); }
public override void Enter(PlayerStateEntry upperState) { waitingCommand.Enter(); anim.SetBool("JumpOfTop", false); }
public override void ChangeState(PlayerStateEntry nextState) { currentState.Exit(this); currentState = nextState; currentState.Enter(this); }
public override void Exit(PlayerStateEntry upperState) { currentState.Exit(this); }
//行動状態変数を初期化 public void Initialize(GameObject usingObj) { PlayerCommandBase[] command = new PlayerCommandBase[15]; waitingCommand = usingObj.AddComponent <WaitingCommand>(); runningCommand = usingObj.AddComponent <RunningCommand>(); slideRunningCommand = usingObj.AddComponent <SlideRunningCommand>(); jumpingFirstCommand = usingObj.AddComponent <JumpingFirstCommand>(); jumpingSecondCommand = usingObj.AddComponent <JumpingSecondCommand>(); jumpingWithUpToDownCommand = usingObj.AddComponent <JumpingWithUpToDownCommand>(); slideJumpingCommand = usingObj.AddComponent <SlideJumpingCommand>(); wallJumpingCommand = usingObj.AddComponent <WallJumpingCommand>(); cliffHoldingCommand = usingObj.AddComponent <CliffHoldingCommand>(); attackingFirstCommand = usingObj.AddComponent <AttackingFirstCommand>(); attackingSecondCommand = usingObj.AddComponent <AttackingSecondCommand>(); attackingThirdCommand = usingObj.AddComponent <AttackingThirdCommand>(); attackingInAirCommand = usingObj.AddComponent <AttackingInAirlialCommand>(); nockBackingCommand = usingObj.AddComponent <NockBackingCommand>(); dyingCommand = usingObj.AddComponent <DyingCommand>(); command[0] = waitingCommand; command[1] = runningCommand; command[2] = slideRunningCommand; command[3] = jumpingFirstCommand; command[4] = jumpingSecondCommand; command[5] = jumpingWithUpToDownCommand; command[6] = slideJumpingCommand; command[7] = wallJumpingCommand; command[8] = cliffHoldingCommand; command[9] = attackingFirstCommand; command[10] = attackingSecondCommand; command[11] = attackingThirdCommand; command[12] = attackingInAirCommand; command[13] = nockBackingCommand; command[14] = dyingCommand; for (int i = 0; i < command.Length; i++) { command[i].Initialize(usingObj); } PlayerStateEntry[] move = new PlayerStateEntry[3]; waiting = usingObj.AddComponent <Waiting>(); running = usingObj.AddComponent <Running>(); slideRunning = usingObj.AddComponent <SlideRunning>(); move[0] = waiting; move[1] = running; move[2] = slideRunning; for (int i = 0; i < move.Length; i++) { move[i].SubInitialize(usingObj); } PlayerStateEntry[] jump = new PlayerStateEntry[6]; jumpingFirst = usingObj.AddComponent <JumpingFirst>(); jumpingSecond = usingObj.AddComponent <JumpingSecond>(); jumpingWithUpToDown = usingObj.AddComponent <JumpingWithUpToDown>(); slideJumping = usingObj.AddComponent <SlideJumping>(); wallJumping = usingObj.AddComponent <WallJumping>(); cliffHolding = usingObj.AddComponent <CliffHolding>(); jump[0] = jumpingFirst; jump[1] = jumpingSecond; jump[2] = jumpingWithUpToDown; jump[3] = slideJumping; jump[4] = wallJumping; jump[5] = cliffHolding; for (int i = 0; i < jump.Length; i++) { jump[i].SubInitialize(usingObj); } PlayerStateEntry[] damage = new PlayerStateEntry[2]; nockBacking = usingObj.AddComponent <NockBacking>(); dying = usingObj.AddComponent <Dying>(); damage[0] = nockBacking; damage[1] = dying; for (int i = 0; i < damage.Length; i++) { damage[i].SubInitialize(usingObj); } PlayerStateEntry[] attack = new PlayerStateEntry[4]; attackingFirst = usingObj.AddComponent <AttackingFirst>(); attackingSecond = usingObj.AddComponent <AttackingSecond>();; attackingThird = usingObj.AddComponent <AttackingThird>();; attackingInAir = usingObj.AddComponent <AttackingInAirlial>();; attack[0] = attackingFirst; attack[1] = attackingSecond; attack[2] = attackingThird; attack[3] = attackingInAir; for (int i = 0; i < attack.Length; i++) { attack[i].SubInitialize(usingObj); } PlayerStateEntry[] main = new PlayerStateEntry[4]; moving = usingObj.AddComponent <PlayerMovingStateMachine>(); jumping = usingObj.AddComponent <PlayerJumpingStateMachine>(); attacking = usingObj.AddComponent <PlayerAttackingStateMachine>(); damaging = usingObj.AddComponent <PlayerDamagingStateMachine>(); main[0] = moving; main[1] = jumping; main[2] = attacking; main[3] = damaging; for (int i = 0; i < main.Length; i++) { main[i].SubInitialize(usingObj); } usingObj.GetComponent <PlayerStateMachine>().SubInitialize(usingObj); }
public override void Enter(PlayerStateEntry upperState) { currentState = waiting; currentState.Enter(this); }
PlayerStateEntry preState; //前フレームの状態 //初期化 protected override void SubInitialize(GameObject usingObj) { currentState = moving; preState = moving; currentState.Enter(this); }