Ejemplo n.º 1
0
    public void InitializePlayerStateMachine()
    {
        idleState        = new PlayerIdleState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData);
        walkState        = new PlayerWalkState(stateMachine, this, AlfAnimationHash.RUN_0, playerData);
        jumpState        = new PlayerJumpState(stateMachine, this, AlfAnimationHash.JUMP_0, playerData);
        inAirState       = new PlayerInAirState(stateMachine, this, AlfAnimationHash.INAIR_0, playerData);
        meleeAttackState = new PlayerMeleeAttackState(stateMachine, this, AlfAnimationHash.ATTACK_0, playerData);
        parryState       = new PlayerParryState(stateMachine, this, AlfAnimationHash.PARRY_1, playerData);
        rollState        = new PlayerRollState(stateMachine, this, AlfAnimationHash.ROLL_0, playerData);
        stunState        = new PlayerStunState(stateMachine, this, AlfAnimationHash.STUN_0, playerData);
        deadState        = new PlayerDeadState(stateMachine, this, AlfAnimationHash.DEAD_0, playerData);
        takeDamageState  = new PlayerTakeDamageState(stateMachine, this, AlfAnimationHash.TAKEDAMAGE_0, playerData);
        wallState        = new PlayerWallState(stateMachine, this, AlfAnimationHash.WALL_0, playerData);
        dashState        = new PlayerDashState(stateMachine, this, AlfAnimationHash.DASH_0, playerData);
        converseState    = new PlayerConverseState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData);
        cinemaState      = new PlayerCinemaState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData);
        ladderState      = new PlayerLadderState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData);

        InitializePlayerCooldownTimer();
    }
Ejemplo n.º 2
0
    public void InitializePlayerStateMachine()
    {
        idleState        = new PlayerIdleState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData);
        walkState        = new PlayerWalkState(stateMachine, this, AlfAnimationHash.RUN_0, playerData);
        jumpState        = new PlayerJumpState(stateMachine, this, AlfAnimationHash.JUMP_0, playerData);
        inAirState       = new PlayerInAirState(stateMachine, this, AlfAnimationHash.INAIR_0, playerData);
        meleeAttackState = new PlayerMeleeAttackState(stateMachine, this, AlfAnimationHash.ATTACK_IRONSWORD, playerData);
        bowAttackState   = new PlayerBowAttackState(stateMachine, this, AlfAnimationHash.IDLE_WOODBOW, playerData);
        magicAttackState = new PlayerMagicAttackState(stateMachine, this, AlfAnimationHash.IDLE_APPRENTICE_STICK, playerData);
        parryState       = new PlayerParryState(stateMachine, this, AlfAnimationHash.PARRY_1, playerData);
        rollState        = new PlayerRollState(stateMachine, this, AlfAnimationHash.ROLL_0, playerData);
        stunState        = new PlayerStunState(stateMachine, this, AlfAnimationHash.STUN_0, playerData);
        deadState        = new PlayerDeadState(stateMachine, this, AlfAnimationHash.DEAD_0, playerData);
        takeDamageState  = new PlayerTakeDamageState(stateMachine, this, AlfAnimationHash.TAKEDAMAGE_0, playerData);
        wallState        = new PlayerWallState(stateMachine, this, AlfAnimationHash.WALL_0, playerData);
        dashState        = new PlayerDashState(stateMachine, this, AlfAnimationHash.DASH_0, playerData);
        converseState    = new PlayerConverseState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData);
        cinemaState      = new PlayerCinemaState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData);
        ladderState      = new PlayerLadderState(stateMachine, this, AlfAnimationHash.IDLE_0, playerData);
        wakeupState      = new PlayerWakeupState(stateMachine, this, AlfAnimationHash.WAKEUP_SITUP_0, playerData);
        littleSunState   = new PlayerLittleSunState(stateMachine, this, AlfAnimationHash.LITTLESUN_SIT_0, playerData);

        InitializePlayerCooldownTimer();
    }
Ejemplo n.º 3
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------

        public Player()
        {
            movement = new PlayerMoveComponent(this);

            // Unit properties.
            centerOffset          = new Point2I(0, -5);
            Health                = 4 * 3;
            MaxHealth             = 4 * 3;
            swimmingSkills        = PlayerSwimmingSkills.CantSwim;
            tunic                 = PlayerTunics.GreenTunic;
            moveAnimation         = GameData.ANIM_PLAYER_DEFAULT;
            knockbackSpeed        = GameSettings.PLAYER_KNOCKBACK_SPEED;
            hurtKnockbackDuration = GameSettings.PLAYER_HURT_KNOCKBACK_DURATION;
            bumpKnockbackDuration = GameSettings.PLAYER_BUMP_KNOCKBACK_DURATION;

            // Physics.
            Physics.CollisionBox             = new Rectangle2F(-4, -10 + 3, 8, 9);
            Physics.SoftCollisionBox         = new Rectangle2F(-6, -14 + 3, 12, 13);
            Physics.CollideWithWorld         = true;
            Physics.CollideWithEntities      = true;
            Physics.CollideWithRoomEdge      = true;
            Physics.CheckRadialCollisions    = true;
            Physics.RoomEdgeCollisionBoxType = CollisionBoxType.Soft;
            Physics.HasGravity                   = true;
            Physics.AutoDodges                   = true;
            Physics.MovesWithConveyors           = true;
            Physics.MovesWithPlatforms           = true;
            Physics.AllowEdgeClipping            = true;
            Physics.IsCrushable                  = true;
            Physics.EdgeClipAmount               = 1;
            Physics.CrushMaxGapSize              = 4;
            Physics.CustomTileCollisionCondition = delegate(Tile tile) {
                if (movement.IsOnColorBarrier && (tile is TileColorBarrier))
                {
                    return(false);
                }
                return(true);
            };

            // Graphics.
            Graphics.DepthLayer      = DepthLayer.PlayerAndNPCs;
            Graphics.DepthLayerInAir = DepthLayer.InAirPlayer;
            Graphics.DrawOffset      = new Point2I(-8, -13);

            // Init tools.
            toolShield = new PlayerToolShield();
            toolSword  = new PlayerToolSword();
            toolVisual = new PlayerToolVisual();

            // Create the basic player states.
            stateNormal         = new PlayerNormalState();
            stateBusy           = new PlayerBusyState();
            stateSwim           = new PlayerSwimState();
            stateLadder         = new PlayerLadderState();
            stateLedgeJump      = new PlayerLedgeJumpState();
            stateSwingSword     = new PlayerSwingSwordState();
            stateSwingBigSword  = new PlayerSwingBigSwordState();
            stateSwingMagicRod  = new PlayerSwingMagicRodState();
            stateSwingCane      = new PlayerSwingCaneState();
            stateHoldSword      = new PlayerHoldSwordState();
            stateSwordStab      = new PlayerSwordStabState();
            stateSpinSword      = new PlayerSpinSwordState();
            stateSeedShooter    = new PlayerSeedShooterState();
            stateSwitchHook     = new PlayerSwitchHookState();
            stateMagicBoomerang = new PlayerMagicBoomerangState();
            stateGrab           = new PlayerGrabState();
            stateCarry          = new PlayerCarryState();
            statePullHandle     = new PlayerPullHandleState();
            stateRespawnDeath   = new PlayerRespawnDeathState();
            stateMinecart       = new PlayerMinecartState();
            stateJumpTo         = new PlayerJumpToState();
        }