コード例 #1
0
    protected override void Start()
    {
        base.Start();
        gc1_ota = (GC1_ObjectToAlive)objectToAlive;

        battleBeginState  = new GC1_BattleBeginState(stateMachine, this, "battleBegin", this);
        chargeState       = new GC1_ChargeState(stateMachine, this, "charge", chargeStateData, damageBox, this);
        defeatState       = new GC1_DefeatState(stateMachine, this, "defeat", this);
        defenceState      = new GC1_DefenceState(stateMachine, this, "defence", defenceStateData, this);
        detectPlayerState = new GC1_DetectPlayerState(stateMachine, this, null, detectPlayerStateData, this);
        evadeState        = new GC1_EvadeState(stateMachine, this, "evade", evadeStateData, this);
        combatIdleState   = new GC1_CombatIdleState(stateMachine, this, "combatIdle", idleStateData, this);
        parryState        = new GC1_ParryState(stateMachine, this, "parry", parryStateData, this);
        runState          = new GC1_RunState(stateMachine, this, "run", runStateData, this);
        stunState         = new GC1_StunState(stateMachine, this, "stun", stunStateData, this);
        meleeAttackState  = new GC1_MeleeAttackState(stateMachine, this, "meleeAttack", meleeAttackStateData, hitbox, this);
        flipState         = new GC1_FlipState(stateMachine, this, null);

        stateMachine.Initialize(battleBeginState);

        stateCooldownTimer = new StateCooldownTimer();
        stateCooldownTimer.AddStateTimer(meleeAttackState);
        stateCooldownTimer.AddStateTimer(evadeState);
        stateCooldownTimer.AddStateTimer(chargeState);
        stateCooldownTimer.AddStateTimer(defenceState);
        stateCooldownTimer.AddStateTimer(parryState);
        stateCooldownTimer.AddStateTimer(flipState);

        stateMachine.SetStateCooldownTimer(stateCooldownTimer);

        // set rigidbody to static
        gc1_ota.gameObject.GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Static;
    }
コード例 #2
0
    protected override void Start()
    {
        base.Start();
        SetInitialFacingDirection(-1);
        Reset();

        stoneState        = new SME1_StoneState(stateMachine, this, "stone", this);
        recoverState      = new SME1_RecoverState(stateMachine, this, "recover", this);
        walkState         = new SME1_WalkState(stateMachine, this, "move", walkStateData, this);
        flipState         = new SME1_FlipState(stateMachine, this, "flip", walkState, this);
        deadState         = new SME1_DeadState(stateMachine, this, "dead", deadStateData, this);
        stunState         = new SME1_StunState(stateMachine, this, "stun", stunStateData, this);
        heideAttackState  = new SME1_HeideAttackState(stateMachine, this, "heideAttack", meleeAttackStateData, hitbox, this);
        chargeState       = new SME1_ChargeState(stateMachine, this, "charge", meleeAttackStateData, chargeStateData, damageBox, this);
        evadeState        = new SME1_EvadeState(stateMachine, this, "evade", evadeStateData, this);
        detectPlayerState = new SME1_DetectPlayerState(stateMachine, this, "empty", detectPlayerStateData, this);
        transformState    = new SME1_TransformState(stateMachine, this, "transform", this);

        // ==== STAGE TWO ====
        stageTwoIdleState           = new SME1_StageTwoIdleState(stateMachine, this, "s2_idle", stageTwoIdleStateData, this);
        stageTwoHeideAttackState    = new SME1_StageTwoHeideAttackState(stateMachine, this, "s2_heideAttack", meleeAttackStateData, hitbox, this);
        stageTwoFlipState           = new SME1_StageTwoFlipState(stateMachine, this, "s2_flip", stageTwoIdleState, this);
        stageTwoTentacleAttackState = new SME1_StageTwoTentacleAttackState(stateMachine, this, "s2_idle", tentacleAttackStateData, this);

        // reading data from loaded save database
        isAwake = false;
        // if statement here to check if first time
        stateMachine.Initialize(stoneState);

        stateCooldownTimer = new StateCooldownTimer();
        stateCooldownTimer.AddStateTimer(chargeState);
        stateCooldownTimer.AddStateTimer(heideAttackState);
        stateCooldownTimer.AddStateTimer(evadeState);

        stateMachine.SetStateCooldownTimer(stateCooldownTimer);

        // init state
        currentStage = 0;
    }
コード例 #3
0
 public void SetStateCooldownTimer(StateCooldownTimer stateCooldownTimer)
 {
     this.stateCooldownTimer = stateCooldownTimer;
 }