Ejemplo n.º 1
0
 public NStateBounced(NStateInfo info, EState state, float initialVelocity, int lockoutFrames) : base(info, state)
 {
     directionSwitchRatio     = info.bd.bouncedDirectionSwitchRatio;
     maxLateralVelocity       = info.bd.bouncedMaxLateralVelocity;
     initialVerticalVelocity  = initialVelocity;
     _transitionLockoutFrames = lockoutFrames;
 }
Ejemplo n.º 2
0
    void Start()
    {
        rigidBody      = GetComponent <Rigidbody2D>();
        boxCollider    = GetComponent <BoxCollider2D>();
        animator       = GetComponent <Animator>();
        spriteRenderer = GetComponent <SpriteRenderer>();
        fireParticles  = transform.GetChild(0).GetComponent <ParticleSystem>();
        bloodParticles = transform.GetChild(1).GetComponent <ParticleSystem>();

        joystick                 = ReInput.players.GetPlayer(playerNumber);
        movementBools            = new Dictionary <string, bool>();
        movementBools["pushed"]  = false;
        movementBools["succed"]  = false;
        movementBools["bounced"] = false;
        movementBools["frozen"]  = false;
        movementBools["ashed"]   = false;
        movementBools["spiked"]  = false;
        movementBools["slipped"] = false;
        movementBools["doubled"] = false;
        movementBools["active"]  = false;
        NStateInfo info = new NStateInfo(this, rigidBody, boxCollider, joystick, animator, spriteRenderer, balanceData);

        movementStates     = new NState[13];
        movementStates[0]  = new NStateNormal(info, EState.normal);
        movementStates[1]  = new NStateJump1(info, EState.jump1);
        movementStates[2]  = new NStateJump2(info, EState.jump2);
        movementStates[3]  = new NStateAshes(info, EState.ashes);
        movementStates[4]  = new NStateAirborne(info, EState.airborne);
        movementStates[5]  = new NStateSucc(info, EState.succ, transform.position);
        movementStates[6]  = new NStatePushed(info, EState.pushed, Vector2.zero);
        movementStates[7]  = new NStateBounced(info, EState.bounced, info.bd.bouncedInitialVelocity, info.bd.bouncedTransitionLockoutFrames);
        movementStates[8]  = new NStateSpiked(info, EState.spiked, Vector2.zero);
        movementStates[9]  = new NStateSlipped(info, EState.slipped);
        movementStates[10] = new NStateSlam(info, EState.slam);
        movementStates[11] = new NStateBounced(info, EState.boinked, info.bd.boinkedInitialVelocity, info.bd.boinkedTransitionLockoutFrames);
        movementStates[12] = new NStateInactive(info, EState.inactive);

        movementState = movementStates[12];

        weapons = new SortedList <EElement, Queue <NWeapon> >(6);
        weapons[EElement.air]    = new Queue <NWeapon>(weaponCounts[0]);
        weapons[EElement.fire]   = new Queue <NWeapon>(weaponCounts[1]);
        weapons[EElement.water]  = new Queue <NWeapon>(weaponCounts[2]);
        weapons[EElement.earth]  = new Queue <NWeapon>(weaponCounts[3]);
        weapons[EElement.plasma] = new Queue <NWeapon>(weaponCounts[4]);
        weapons[EElement.none]   = new Queue <NWeapon>(1);
        weaponEquipped           = EElement.air;
        weapon    = null;
        totem     = null;
        totemDist = Mathf.Infinity;
        living    = true;
        avatar    = false;
    }
Ejemplo n.º 3
0
    public NStateJump1(NStateInfo info, EState state) : base(info, state)
    {
        directionSwitchRatio      = info.bd.jump1DirectionSwitchRatio;
        maxLateralVelocity        = info.bd.jump1MaxLateralVelocity;
        initialVerticalVelocity   = info.bd.jump1InitialVelocity;
        continuedHoldVelocity     = info.bd.jump1ContinuedHoldVelocity;
        _continuedHoldFrames      = info.bd.jump1ContinuedHoldFrames;
        _continuedHoldDelayFrames = info.bd.jump1ContinuedHoldDelayFrames;

        _shortHopFrames    = info.bd.jump1ShortHopFrames;
        shortHopVelocity   = info.bd.jump1ShortHopVelocity;
        regularHopVelocity = info.bd.jump1RegularHopVelocity;
    }
Ejemplo n.º 4
0
    public NState(NStateInfo info, EState state)
    {
        this.state      = state;
        player          = info.p;
        rb              = info.r;
        bc              = info.b;
        bd              = info.bd;
        ac              = info.ac;
        sr              = info.sr;
        joystick        = info.j;
        freshJumpButton = false;
        heldJumpButton  = false;

        globalGravityPerFrame = info.bd.globalGravityPerFrame;
        frozenSlideSpeed      = info.bd.frozenSlideSpeed;
        frozenGravityPerFrame = info.bd.frozenGravityPerFrame;

        platformsLayer = LayerMask.NameToLayer("Platforms");
    }
Ejemplo n.º 5
0
 public NStateJump2(NStateInfo info, EState state) : base(info, state)
 {
     directionSwitchRatio    = info.bd.jump2DirectionSwitchRatio;
     maxLateralVelocity      = info.bd.jump2MaxLateralVelocity;
     initialVerticalVelocity = info.bd.jump2InitialVelocity;
 }
Ejemplo n.º 6
0
 public NStateSucc(NStateInfo info, EState state, Vector3 blackHole) : base(info, state)
 {
     this.blackHole = blackHole;
 }
Ejemplo n.º 7
0
 public NStateInactive(NStateInfo info, EState state) : base(info, state)
 {
 }
Ejemplo n.º 8
0
 public NStatePushed(NStateInfo info, EState state, Vector2 pushDirection) : base(info, state)
 {
     this.pushDirection  = pushDirection;
     _pushDuration       = info.bd.pushedDuration;
     pushInitialVelocity = info.bd.pushedInitialVelocity;
 }
Ejemplo n.º 9
0
 public NStateSpiked(NStateInfo info, EState state, Vector2 spikedDirection) : base(info, state)
 {
     this.spikedDirection = spikedDirection;
 }
Ejemplo n.º 10
0
 public NStateSlipped(NStateInfo info, EState state) : base(info, state)
 {
     directionSwitchRatio = info.bd.slippedDirectionSwitchRatio;
     maxLateralVelocity   = info.bd.slippedMaxLateralVelocity;
 }
Ejemplo n.º 11
0
 public NStateNormal(NStateInfo info, EState state) : base(info, state)
 {
     directionSwitchRatio = info.bd.normalDirectionSwitchRatio;
     maxLateralVelocity   = info.bd.normalMaxLateralVelocity;
 }
Ejemplo n.º 12
0
 public NStateSlam(NStateInfo info, EState state) : base(info, state)
 {
     maxLateralVelocity       = info.bd.slamMaxLateralVelocity;
     increasedGravityPerFrame = info.bd.slamIncreasedGravityPerFrame;
     _jumpLockoutFrames       = info.bd.slamJumpLockoutFrames;
 }
Ejemplo n.º 13
0
 public NStateAirborne(NStateInfo info, EState state) : base(info, state)
 {
     directionSwitchRatio = info.bd.airborneDirectionSwitchRatio;
     maxLateralVelocity   = info.bd.airborneMaxLateralVelocity;
 }
Ejemplo n.º 14
0
 public NStateAshes(NStateInfo info, EState state) : base(info, state)
 {
     gravityPerFrame = info.bd.ashGravityPerFrame;
 }