Beispiel #1
0
        public BasePlayer(IPlayerSettings playerSettings, IPhysicsComponent physicsComponent, IBoundaryCollider boundaryCollider, IWeapons weapons, ITimer timer)
        {
            this.PlayerSettings = playerSettings;
            this.PlayerScore = new PlayerScore();

            if (physicsComponent == null)
                this.PhysicsComponent = new DummyPhysicsComponent();
            else
                this.PhysicsComponent = physicsComponent;

            this.PhysicsComponent.CollidedWithWorld += () => InContactWithLevel = true;
            this.PhysicsComponent.WasShot += Damage;

            this.Weapons = weapons;
            this.Weapons.DamagedAPlayer += (damage, physicsComp) => physicsComp.OnWasShot(this, damage);

            this.Timer = timer;
            this.BoundaryCollider = boundaryCollider;

            this.Health = BasePlayer.StartHealth;
            this.Status = PlayerStatus.Alive;
            this.Position = new Vector2(400, 100);

            this.PhysicsComponent.CollisionGroup = BasePlayer.CollisionGroup;
        }
Beispiel #2
0
 public void SetUp()
 {
     stubPlayerSettings = MockRepository.GenerateStub<IPlayerSettings>();
     stubPhysicsComponent = MockRepository.GenerateStub<IPhysicsComponent>();
     stubBoundaryCollider = MockRepository.GenerateStub<IBoundaryCollider>();
     stubWeapons = MockRepository.GenerateStub<IWeapons>();
     stubTimer = MockRepository.GenerateStub<ITimer>();
     player = new BasePlayer(stubPlayerSettings, stubPhysicsComponent, stubBoundaryCollider, stubWeapons, stubTimer);
 }
Beispiel #3
0
 public LocalPlayer(IPlayerSettings playerSettings, IPhysicsComponent physicsComponent, IBoundaryCollider boundaryCollider, IWeapons weapons, ITimer timer)
     : base(playerSettings, physicsComponent, boundaryCollider, weapons, timer)
 {
     Console.Write("Creating Local Player");
 }