示例#1
0
        public override void LoadContent()
        {
            Body = CurrentWorld.AddBody(this, InitPosition, Size);
            Body.ChildHitboxes[Key + "_body"] = new Hitbox(this, new Vector2(0, 0), Size, Key + "_body")
            {
                DebugSprite = Debug.Assets.BlueBox,
                Data        = new CollisionPackage()
                {
                    Value = Key
                }
            };

            AnimationHandler = new AnimationHandler(this)
            {
                LayerDepth = 1f,
            };
            AnimationHandler.SetShaderEffect(new PanelLines());
            _animationLibrary = new Player_AnimationLibrary();
            _animationLibrary.LoadAnimations(AnimationHandler);

            _controller         = Game.GlobalKeyboard;
            _controller.History = new InputRecord(_controller);
            _controller.History.InitKBRecord();

            State           = new Player_State();
            _behaviorScript = new Player_BehaviorScript(this);
            _behaviorScript.SetController(ref _controller);
            _behaviorScript.InitBehaviors();

            AnimationHandler.ChangeAnimation((int)AnimationStates.Idle);
            AnimationHandler.Facing = Orientation.Right;
        }
示例#2
0
            public Player_Idle(Player_BehaviorScript behaviorScript) : base(behaviorScript._animationHandler)
            {
                _player         = behaviorScript._player;
                _behaviorScript = behaviorScript;
                _body           = behaviorScript._body;

                BehaviorFunctions += CheckJumpInput;
                BehaviorFunctions += CheckMoveInput;
                BehaviorFunctions += CheckAirborne;
                BehaviorFunctions += CheckAttack1Input;
                BehaviorFunctions += CheckAttack2Input;
            }
示例#3
0
            public AttackTest2(Player_BehaviorScript behaviorScript) : base(behaviorScript._animationHandler)
            {
                _player           = behaviorScript._player;
                _behaviorScript   = behaviorScript;
                _animationHandler = behaviorScript._animationHandler;
                _body             = behaviorScript._body;
                _animation        = _animationHandler.Animations[(int)AnimationStates.Attack2_1];
                _frameActions     = new Action[_animation.FrameCount * _animation.FrameDelay];

                _startup  += FA_Attack2_GotoAirborne;
                _airborne += FA_Attack2_CheckLand;
                _airborne += FA_Attack2_Airborne;
                _landing  += FA_Attack2_Slide;

                BehaviorFunctions = _startup;
            }
示例#4
0
            public AttackTest(Player_BehaviorScript behaviorScript) : base(behaviorScript._animationHandler)
            {
                _player           = behaviorScript._player;
                _behaviorScript   = behaviorScript;
                _animationHandler = behaviorScript._animationHandler;
                _animation        = _animationHandler.Animations[(int)AnimationStates.Attack1];
                _frameActions     = new Action[_animation.FrameCount * _animation.FrameDelay];

                _hitbox1 = new Hitbox(_player, new Vector2(53, 14), new Point(80, 16), _player.Key + "_AttackTest_hitbox1", 2)
                {
                    DebugSprite = Debug.Assets.RedBox,
                    Data        = new CollisionPackage()
                    {
                        Value = "From player",
                        Type  = CollisionType.Attack,
                    },
                };

                _frameActions[17]  = TestMe;
                BehaviorFunctions += _behaviorScript.FA_ReturnToIdle;
            }