Пример #1
0
        //-----------------------------------------------------------------------------
        // Constructors
        //-----------------------------------------------------------------------------
        public Player()
        {
            direction			= Directions.Down;
            useDirection		= 0;
            useAngle			= 0;
            autoRoomTransition	= false;
            syncAnimationWithDirection = true;
            movement = new PlayerMoveComponent(this);

            // Unit properties.
            originOffset	= new Point2I(0, -2);
            centerOffset	= new Point2I(0, -8);
            Health			= 4 * 3;
            MaxHealth		= 4 * 3;
            swimmingSkills	= PlayerSwimmingSkills.CantSwim;
            invincibleTimer	= 0;
            tunic			= PlayerTunics.GreenTunic;

            // Physics.
            Physics.CollisionBox		= new Rectangle2F(-4, -10, 8, 9);
            Physics.SoftCollisionBox	= new Rectangle2F(-6, -14, 12, 13);
            Physics.CollideWithWorld	= true;
            Physics.CollideWithEntities	= true;
            Physics.CollideWithRoomEdge	= true;
            Physics.HasGravity			= true;

            // Graphics.
            Graphics.ShadowDrawOffset = originOffset;
            Graphics.DrawOffset = new Point2I(-8, -16);

            // Create the basic player states.
            state			= null;
            stateNormal		= new PlayerNormalState();
            stateBusy		= new PlayerBusyState();
            stateSwim		= new PlayerSwimState();
            stateLadder		= new PlayerLadderState();
            stateLedgeJump	= new PlayerLedgeJumpState();
            stateSwing		= new PlayerSwingState();
            stateHoldSword	= new PlayerHoldSwordState();
            stateSpinSword	= new PlayerSpinSwordState();

            toolAnimation	= new AnimationPlayer();
        }
Пример #2
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();
        }
Пример #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();
        }