Пример #1
0
        protected override void KillPlayer()
        {
            ActiveCamera   = DefaultCamera;
            currentSoldier = null;

            base.KillPlayer();
        }
Пример #2
0
        public override void Start()
        {
            if (Camera == null)
            {
                throw new ArgumentException("Camera is not set");
            }
            if (ShootSource == null)
            {
                throw new ArgumentException("ShootSource is not set");
            }
            if (BulletPerSeconds <= 0)
            {
                throw new ArgumentException("BulletPerSeconds must be > 0");
            }
            if (MaxAmmo <= 0)
            {
                throw new ArgumentException("MaxAmmo must be > 0");
            }
            CurrentAmmo = MaxAmmo;

            soldier     = Entity.Get <SoldierController>();
            reloadSound = ShootSource.Get <AudioEmitterComponent>()["Reload"];

            // Handle reload event
            soldier.Input.OnReload += (e) =>
            {
                if (!IsReloading && CurrentAmmo != MaxAmmo)
                {
                    Reload();
                }
            };
            BulletPerSeconds = 40;
        }
Пример #3
0
        protected override void PreSpawnPlayer(Entity playerEntity)
        {
            var controller = playerEntity.Get <SoldierController>();

            if (controller != null)
            {
                Player = currentSoldier = controller;
                IPlayerInput input = playerEntity.Get <SoldierPlayerInput>();
                Player.Init(input);
            }
        }