Ejemplo n.º 1
0
    public void HitByAir(Vector2 direction)
    {
        NStatePushed pushed = (NStatePushed)movementStates[6];

        pushed.SetPushedDirection(direction);
        movementState.SetBool("pushed", true);
    }
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;
    }