示例#1
0
        public PlayerVectorRendererComponent(
            PlayerRigidbody playerRigidbody,
            PlayerStateMachine stateMachine)
        {
            this.playerRigidbody_ = playerRigidbody;
            this.stateMachine_    = stateMachine;

            this.root_ = Bone2.NewRoot(90);

            var playerHeight = PlayerConstants.VSIZE;

            var hipWidth = PlayerConstants.HSIZE * .7f;

            this.hipCenter_ = this.root_.AddChild(0, 0);
            this.hipLeft_   = this.hipCenter_.AddChild(hipWidth / 2, 90);
            this.hipRight_  = this.hipCenter_.AddChild(hipWidth / 2, -90);

            var legHeight = playerHeight / 2;

            var upperLegLength = legHeight / 2;

            this.upperLegLeft_  = this.hipLeft_.AddChild(upperLegLength, 90);
            this.upperLegRight_ = this.hipRight_.AddChild(upperLegLength, -90);

            var lowerLegLength = legHeight - upperLegLength;

            this.lowerLegLeft_  = this.upperLegLeft_.AddChild(lowerLegLength, 0);
            this.lowerLegRight_ = this.upperLegRight_.AddChild(lowerLegLength, 0);
        }
示例#2
0
        public PlayerComponent(
            IGamepad gamepad,
            PlayerRigidbody playerRigidbody,
            PlayerSoundsComponent playerSounds,
            PlayerStateMachine playerStateMachine)
        {
            this.gamepad_ = gamepad;

            this.playerRigidbody_ = playerRigidbody;
            this.rigidbody_       = playerRigidbody.Rigidbody;

            this.playerSounds_ = playerSounds;
            this.stateMachine_ = playerStateMachine;

            this.levelGridRenderer_ = new LevelGridRenderer {
                LevelGrid = LevelConstants.LEVEL_GRID,
            };

            this.motor_ = new PlayerMotor {
                StateMachine    = this.stateMachine_,
                PlayerRigidbody = this.playerRigidbody_,
            };

            this.collider_ = new PlayerCollider {
                StateMachine    = this.stateMachine_,
                PlayerRigidbody = this.playerRigidbody_,
            };

            this.boxPlayerRenderer_ = new BoxPlayerRenderer {
                PlayerRigidbody = this.playerRigidbody_,
            };
        }
示例#3
0
 public SwordComponent(
     IGamepad gamepad,
     PlayerRigidbody playerRigidbody,
     PlayerStateMachine stateMachine)
 {
     this.gamepad_         = gamepad;
     this.playerRigidbody_ = playerRigidbody;
     this.stateMachine_    = stateMachine;
 }
示例#4
0
        public WhipComponent(
            IGamepad gamepad,
            PlayerRigidbody playerRigidbody,
            PlayerSoundsComponent playerSounds,
            PlayerStateMachine stateMachine)
        {
            this.gamepad_         = gamepad;
            this.playerRigidbody_ = playerRigidbody;
            this.playerSounds_    = playerSounds;
            this.stateMachine_    = stateMachine;

            var whipPointCount = 10;

            this.whipPoints_ = new MutableVector2 <float> [whipPointCount];
            for (var i = 0; i < whipPointCount; ++i)
            {
                this.whipPoints_[i] = new MutableVector2 <float>();
            }
        }
        public ItemSwitcherComponent(
            IGamepad gamepad,
            PlayerRigidbody playerRigidbody,
            PlayerSoundsComponent playerSounds,
            PlayerStateMachine stateMachine)
        {
            this.gamepad_ = gamepad;

            this.itemComponents_ = new IItemComponent[] {
                new ShieldComponent(gamepad,
                                    playerRigidbody,
                                    stateMachine),
                new WhipComponent(gamepad,
                                  playerRigidbody,
                                  playerSounds,
                                  stateMachine),
                new SwordComponent(gamepad,
                                   playerRigidbody,
                                   stateMachine),
            };
            this.currentItemIndex_ =
                new CircularRangedInt(0, 0, this.itemComponents_.Length);
        }