Exemplo n.º 1
0
        public void Execute()
        {
            ServerGameEntity playerEntity = gameContext.GetEntityWithId(PlayerIdStorage.PlayerEntityId);

            if (playerEntity == null)
            {
                log.Debug("playerEntity is null");
                return;
            }

            if (!playerEntity.hasTransform)
            {
                log.Debug("playerEntity dont have hasViewTransform");
                return;
            }

            Vector3   playerPosition  = playerEntity.transform.value.position;
            Transform cameraTransform = mainCamera.transform;
            Vector3   targetPosition  = playerPosition + cameraShift;

            Vector3 currentPosition = cameraTransform.position;
            Vector3 currentVelocity = Vector3.zero;
            float   smoothTime      = 0.07f;

            cameraTransform.position = Vector3.SmoothDamp(currentPosition, targetPosition, ref currentVelocity,
                                                          smoothTime);
            mainCamera.transform.LookAt(cameraTransform.position - cameraShift);
        }
Exemplo n.º 2
0
        public void Execute()
        {
            foreach (var entity in hits)
            {
                ServerGameEntity targetEntity     = entity.hit.targetEntity;
                ServerGameEntity projectileEntity = entity.hit.projectileEntity;

                if (!targetEntity.hasHealthPoints)
                {
                    string message = $"Попадание по объекту без hp id = {targetEntity.id.value}. " +
                                     $"Название объекта {targetEntity.view.gameObject.name}";

                    log.Debug(message);
                    continue;
                }

                if (targetEntity.hasPlayer)
                {
                    warshipHitHandler.Hit(projectileEntity, targetEntity);
                }
                else
                {
                    asteroidHitHandler.Hit(projectileEntity, targetEntity);
                }
            }
        }
Exemplo n.º 3
0
        public ServerGameEntity Create(Vector3 position, ushort tmpPlayerId, int accountId,
                                       ViewTypeEnum viewTypeEnum, WarshipSO warshipSo)
        {
            warshipSoValidator.Validate(warshipSo);

            ServerGameEntity entity = gameContext.CreateEntity();

            entity.AddPlayer(tmpPlayerId);
            entity.AddNickname("warship");
            entity.AddAccount(accountId);
            entity.AddMaxSpeed(warshipSo.maxVelocity);
            entity.AddAngularVelocity(warshipSo.angularVelocity);
            if (warshipSo.maxHealth <= 0)
            {
                throw new Exception($"Нельзя спавнить корабли таких хп {warshipSo.maxHealth}");
            }

            entity.AddHealthPoints(warshipSo.maxHealth);
            entity.AddMaxHealthPoints(warshipSo.maxHealth);
            entity.AddTeam((byte)(tmpPlayerId + 1));
            entity.AddViewType(viewTypeEnum);
            entity.AddSpawnTransform(position, Quaternion.identity);

            return(entity);
        }
Exemplo n.º 4
0
        public void SetUp()
        {
            GameSceneFactory gameSceneFactory = new GameSceneFactory();
            Scene            matchScene       = gameSceneFactory.Create();

            ArrangeTransformSystem[] arrangeCollidersSystems =
            {
                new WithHpArrangeTransformSystem(contexts)
            };
            PhysicsRollbackManager physicsRollbackManager = new PhysicsRollbackManager(arrangeCollidersSystems);

            PhysicsVelocityManager physicsVelocityManager = new PhysicsVelocityManager();
            PhysicsRotationManager physicsRotationManager = new PhysicsRotationManager();
            SnapshotFactory        snapshotFactory        = new SnapshotFactory(contexts.serverGame);

            playerPredictor = new PlayerPredictor(physicsRollbackManager, matchScene,
                                                  contexts.serverGame, physicsVelocityManager, physicsRotationManager, snapshotFactory);

            playerEntity = contexts.serverGame.CreateEntity();
            ClientPrefabsStorage clientPrefabsStorage = new ClientPrefabsStorage();
            GameObject           warshipPrefab        = clientPrefabsStorage.GetPrefab(ViewTypeEnum.StarSparrow1);
            GameObject           go = Object.Instantiate(warshipPrefab, Vector3.zero, Quaternion.identity);

            SceneManager.MoveGameObjectToScene(go, matchScene);
            ushort playerEntityId = 100;

            playerEntity.AddId(playerEntityId);
            playerEntity.AddView(go);
            playerEntity.AddRigidbody(go.GetComponent <Rigidbody>());

            LogAssert.ignoreFailingMessages = true;
        }
        public void Spawn(ServerGameEntity entity)
        {
            ViewTypeEnum viewType      = entity.viewType.value;
            Vector3      spawnPosition = entity.spawnTransform.position;
            Quaternion   spawnRotation = entity.spawnTransform.rotation;

            GameObject prefab = prefabStorage.GetPrefab(viewType);
            GameObject go     = physicsSpawner.SpawnProjectile(prefab, spawnPosition, spawnRotation);

            go.layer = projectileLayerNumber;
            entity.AddTransform(go.transform);
            Rigidbody rigidbody = go.GetComponent <Rigidbody>();

            entity.AddRigidbody(rigidbody);
            go.Link(entity);
            entity.AddView(go);

            if (entity.hasParentWarship)
            {
                var        projectileCollider = go.GetComponent <Collider>();
                Collider[] warshipColliders   = entity.parentWarship.entity.warshipColliders.colliders;


                Vector3 parentVelocity = entity.parentWarship.entity.rigidbody.value.velocity;
                rigidbody.velocity = parentVelocity;
                physicsSpawner.Ignore(new[] { projectileCollider }, warshipColliders);
            }
        }
Exemplo n.º 6
0
 public void Cleanup()
 {
     ServerGameEntity[] entities = needHealthBarDestroyGroup.GetEntities();
     for (int index = 0; index < entities.Length; index++)
     {
         ServerGameEntity entity = entities[index];
         entity.healthBarParent.healthBarEntity.isDestroyed = true;
     }
 }
        public void CreateAsteroid(Vector3 position, ViewTypeEnum viewTypeEnum)
        {
            ServerGameEntity entity = contexts.serverGame.CreateEntity();

            entity.AddHealthPoints(500);
            entity.AddMaxHealthPoints(500);
            entity.AddViewType(viewTypeEnum);
            entity.AddSpawnTransform(position, Quaternion.identity);
        }
        private void AddNewObject(ushort id, ViewTransformCompressed viewTransform)
        {
            ServerGameEntity gameEntity = gameContext.CreateEntity();

            gameEntity.AddId(id);
            gameEntity.AddViewType(viewTransform.viewTypeEnum);
            Quaternion quaternion = Quaternion.AngleAxis(viewTransform.Angle, Vector3.up);

            gameEntity.AddSpawnTransform(viewTransform.GetPosition(), quaternion);
        }
Exemplo n.º 9
0
        public void Execute()
        {
            foreach (var inputEntity in attackGroup)
            {
                ushort           playerId     = inputEntity.playerInput.playerEntityId;
                ServerGameEntity playerEntity = gameContext.GetEntityWithPlayer(playerId);

                shootingHelper.Shoot(playerEntity, inputEntity);
            }
        }
Exemplo n.º 10
0
        public void Execute()
        {
            var entities = needHealthBar.GetEntities();

            for (var index = 0; index < entities.Length; index++)
            {
                var entity = entities[index];
                if (!entity.hasView)
                {
                    log.Error("Если есть NeedHealthBar, то обязательно должен быть view");
                    continue;
                }

                //Создать полоску
                ServerGameEntity healthBarEntity = gameContext.CreateEntity();
                GameObject       prefab          = healthBarStorage.GetPrefab();
                GameObject       go = Object.Instantiate(prefab);
                go.Link(entity);
                go.transform.position = new Vector3(0, healthBarHeightStorage.GetHeight(entity.viewType.value));
                Slider slider = go.transform.Find("Slider").GetComponent <Slider>();
                if (slider == null)
                {
                    log.Error("Не найден слайдер на полоске хп");
                    continue;
                }

                TextMeshProUGUI username = go.transform.Find("Text_Username").GetComponent <TextMeshProUGUI>();
                if (username == null)
                {
                    log.Error("Не найден text username на полоске хп");
                    continue;
                }

                TextMeshProUGUI healthPoints = go.transform.Find("Slider/Text_HealthPoints")
                                               .GetComponent <TextMeshProUGUI>();
                if (healthPoints == null)
                {
                    log.Error("Не найден text healthPoints на полоске хп");
                    continue;
                }


                healthBarEntity.AddView(go);
                healthBarEntity.AddTransform(go.transform);
                healthBarEntity.AddHealthBar(slider, username, healthPoints, entity);

                if (entity.hasHealthBarParent)
                {
                    log.Error("У этой сущности не должно быть этого компонета.");
                    continue;
                }
                entity.AddHealthBarParent(healthBarEntity);
            }
        }
Exemplo n.º 11
0
        // public override GameState PastState { get; set; }
        // public override GameState PresentState { get; set; }

        public override void Execute(ServerGameEntity damageEntity)
        {
            if (!damageEntity.hasTransform)
            {
                return;
            }

            if (!damageEntity.hasDamage)
            {
                return;
            }

            var testTransform = damageEntity.transform.value;

            if (testTransform == null)
            {
                log.Error("Transform пуст");
                return;
            }
            Vector3 currentPosition = damageEntity.transform.value.position;
            Vector3 direction       = damageEntity.transform.value.rotation * Vector3.forward;
            Vector3 velocity        = damageEntity.rigidbody.value.velocity * tickDeltaTimeStorage.GetDeltaTimeSec();

            //Есть столкновение?
            bool collisionOccurred = physicsRaycaster
                                     .Raycast(currentPosition, direction, velocity.magnitude, out RaycastHit raycastHit);

            if (!collisionOccurred)
            {
                return;
            }

            EntityLink       entityLink   = raycastHit.transform.gameObject.GetEntityLink();
            ServerGameEntity targetEntity = (ServerGameEntity)entityLink.entity;

            if (targetEntity == null)
            {
                return;
            }

            ushort entityId = targetEntity.id.value;

            //Проверка попадания по самому себе
            if (damageEntity.parentWarship.entity.id.value == entityId)
            {
                log.Error($"Попадание по самому себе parentId = {entityId}");
                return;
            }

            ServerGameEntity hitEntity = gameContext.CreateEntity();

            hitEntity.AddHit(damageEntity, targetEntity);
        }
Exemplo n.º 12
0
        public void Spawn(ServerGameEntity gameEntity)
        {
            ViewTypeEnum viewTypeEnum = gameEntity.viewType.value;

            if (dictionary.TryGetValue(viewTypeEnum, out ISpawner spawner))
            {
                spawner.Spawn(gameEntity);
            }
            else
            {
                throw new Exception($"Спавн сущности с таким viewType невозможен. viewTypeEnum={viewTypeEnum}");
            }
        }
Exemplo n.º 13
0
        public void Execute()
        {
            foreach (var inputEntity in inputGroup)
            {
                if (!inputEntity.hasAttack)
                {
                    log.Error("Нет компонента атаки.");
                    continue;
                }

                float desiredAngle = inputEntity.attack.direction;
                if (float.IsNaN(desiredAngle))
                {
                    log.Info("Неправильное значение угла атаки.");
                    continue;
                }

                ushort           playerId     = inputEntity.playerInput.playerEntityId;
                ServerGameEntity playerEntity = gameContext.GetEntityWithPlayer(playerId);
                if (playerEntity == null)
                {
                    log.Error($"Нет такого игрока. {nameof(playerId)} {playerId}");
                    continue;
                }

                if (!playerEntity.hasRigidbody)
                {
                    log.Error($"Нет rigidbody");
                    continue;
                }

                if (float.IsNaN(desiredAngle))
                {
                    playerEntity.rigidbody.value.angularVelocity = Vector3.zero;
                    continue;
                }

                if (!playerEntity.hasAngularVelocity)
                {
                    log.Error("У сущности должен быть AngularVelocity");
                    continue;
                }

                float deltaTimeSec = tickDeltaTimeStorage.GetDeltaTimeSec();

                // float angularVelocity = playerEntity.angularVelocity.value;
                float angularVelocity = 90;
                physicsRotationManager.ApplyRotation(playerEntity.rigidbody.value, desiredAngle, angularVelocity,
                                                     deltaTimeSec);
            }
        }
Exemplo n.º 14
0
        public void Execute()
        {
            Dictionary <ushort, List <Vector3> > playerDirection = new Dictionary <ushort, List <Vector3> >();

            foreach (var inputEntity in inputGroup)
            {
                Vector2 playerJoystickInput = inputEntity.movement.value;
                ushort  playerId            = inputEntity.playerInput.playerEntityId;
                if (!playerDirection.ContainsKey(playerId))
                {
                    playerDirection.Add(playerId, new List <Vector3>());
                }

                Vector3 inputVector = new Vector3(playerJoystickInput.x, 0, playerJoystickInput.y);
                playerDirection[playerId].Add(inputVector);
            }

            foreach (var pair in playerDirection)
            {
                ushort           playerId     = pair.Key;
                ServerGameEntity playerEntity = gameContext.GetEntityWithPlayer(playerId);
                if (playerEntity == null)
                {
                    string message = $"Пришло сообщение о движении от игрока, которого нет в комнате. " +
                                     $"Данные игнорируются. {nameof(playerId)} {playerId}";
                    log.Error(message);
                    return;
                }

                if (!playerEntity.hasRigidbody)
                {
                    log.Error("Нет rigidbody");
                    continue;
                }

                Rigidbody rigidbody = playerEntity.rigidbody.value;
                if (rigidbody.velocity != Vector3.zero)
                {
                    var vector = rigidbody.velocity;
                    throw new Exception($"Не нулевая скорость {vector.x} {vector.y} {vector.z}");
                }

                float          maxSpeed           = 10;
                List <Vector3> inputValues        = pair.Value;
                Vector3        averageInputVector = vector3Utils.GetVelocityVector(inputValues);
                physicsVelocityManager.ApplyVelocity(rigidbody, averageInputVector, maxSpeed);
            }
        }
Exemplo n.º 15
0
        public void Execute()
        {
            HashSet <ushort> ids = new HashSet <ushort>(withTransformGroup
                                                        .GetEntities()
                                                        .Select(item => item.id.value));

            float    matchTime = matchTimeStorage.GetMatchTime();
            Snapshot snapshot;

            try
            {
                snapshot = snapshotManager.CreateInterpolatedSnapshot(matchTime);
            }
            catch (Exception e)
            {
                log.Error(e.FullMessage());
                return;
            }

            if (snapshot == null)
            {
                throw new NullReferenceException($"snapshot is null");
            }

            foreach (var pair in snapshot.transforms)
            {
                ushort entityId = pair.Key;
                ViewTransformCompressed viewTransform = pair.Value;
                ServerGameEntity        gameEntity    = gameContext.GetEntityWithId(entityId);
                if (gameEntity == null)
                {
                    AddNewObject(entityId, viewTransform);
                }
                else
                {
                    UpdateTransform(gameEntity, viewTransform);
                    ids.Remove(gameEntity.id.value);
                }
            }

            foreach (ushort id in ids)
            {
                // log.Debug($"Удаление объекта id = {id}");
                ServerGameEntity gameEntity = gameContext.GetEntityWithId(id);
                gameEntity.isDestroyed = true;
            }
        }
Exemplo n.º 16
0
        public void Hit(ServerGameEntity damageEntity, ServerGameEntity withHp)
        {
            ushort parentId = damageEntity.parentWarship.entity.id.value;

            if (parentId == withHp.id.value)
            {
                throw new Exception("Попадание по родителю не должно считаться");
            }

            //Отнять хп
            float actualHealthPoints = withHp.healthPoints.value - damageEntity.damage.value;

            withHp.ReplaceHealthPoints(actualHealthPoints);

            //Уничтожить снаряд
            damageEntity.isDestroyed = true;
        }
Exemplo n.º 17
0
        public void Execute()
        {
            ushort playerEntityId = PlayerIdStorage.PlayerEntityId;

            if (playerEntityId == 0)
            {
                throw new Exception("Пустой playerEntityId");
            }

            ServerGameEntity playerEntity = gameContext.GetEntityWithId(playerEntityId);

            if (playerEntity.hasRigidbody)
            {
                playerEntity.rigidbody.value.velocity        = Vector3.zero;
                playerEntity.rigidbody.value.angularVelocity = Vector3.zero;
            }
        }
Exemplo n.º 18
0
        public void Cleanup()
        {
            var needDestroy = needDestroyGroup.GetEntities();

            for (int i = 0; i < needDestroy.Length; i++)
            {
                ServerGameEntity entity = needDestroy[i];
                if (entity.hasTransform)
                {
                    GameObject go = entity.transform.value.gameObject;
                    go.Unlink();
                    physicsDestroyer.Destroy(go);
                }

                entity.Destroy();
            }
        }
Exemplo n.º 19
0
        public void Spawn(ServerGameEntity entity)
        {
            ViewTypeEnum viewType      = entity.viewType.value;
            Vector3      spawnPosition = entity.spawnTransform.position;
            Quaternion   spawnRotation = entity.spawnTransform.rotation;
            GameObject   prefab        = prefabStorage.GetPrefab(viewType);
            GameObject   go            = physicsSpawner.Spawn(prefab, spawnPosition, spawnRotation);

            go.Link(entity);
            entity.AddTransform(go.transform);
            Rigidbody rigidbody = go.GetComponent <Rigidbody>();

            entity.AddRigidbody(rigidbody);
            entity.AddView(go);

            //todo не забыть убрать компонент
            // entity.RemoveSpawnTransform();
        }
Exemplo n.º 20
0
        public void Execute()
        {
            lock (lockObj)
            {
                if (entityIds == null)
                {
                    return;
                }

                if (entityIds.Count == 0)
                {
                    return;
                }

                log.Info("Обработка новых игроков " + entityIds.Count);
                var currentEntityIds = new Dictionary <int, ushort>(entityIds);
                foreach (var pair in currentEntityIds)
                {
                    int    accountId = pair.Key;
                    ushort entityId  = pair.Value;
                    // log.Debug($"accountId={accountId} entityId={entityId}");
                    ServerGameEntity entity = gameContext.GetEntityWithId(entityId);

                    //todo обновление id сущности игрока
                    int currentPlayerAccountId = PlayerIdStorage.AccountId;
                    if (accountId == currentPlayerAccountId)
                    {
                        log.Info($"Установка PlayerEntityId={entityId} accountId={accountId}");
                        PlayerIdStorage.PlayerEntityId = entityId;
                    }

                    if (entity != null)
                    {
                        entity.ReplaceNickname(playerInfos[accountId].Nickname);
                        entityIds.Remove(accountId);
                    }
                    else
                    {
                        log.Debug($"Нет сущности с таким id entityId = {entityId}");
                    }
                }
            }
        }
Exemplo n.º 21
0
        public void Predict(ushort playerEntityId, InputMessageModel inputMessageModel, float physicsSimulationDuration)
        {
            //взять ввод игрока
            if (inputMessageModel == null)
            {
                log.Debug("Нет ввода");
                return;
            }

            if (physicsSimulationDuration < 0.005f)
            {
                log.Debug("Что за космический fps?");
            }

            // log.Debug("Тик физики "+physicsSimulationDuration);
            //линейное движение игрока
            ServerGameEntity playerEntity     = gameContext.GetEntityWithId(playerEntityId);
            Rigidbody        warshipRigidbody = playerEntity.rigidbody.value;
            Vector3          inputVector      = inputMessageModel.GetVector3();
            float            maxSpeed         = 10f;

            warshipRigidbody.velocity = Vector3.zero;

            if (inputVector.sqrMagnitude > 0.001f)
            {
                // log.Debug("Линейное движение игрока");
                physicsVelocityManager.ApplyVelocity(warshipRigidbody, inputVector, maxSpeed);
            }

            //вращательное движение игрока
            if (!float.IsNaN(inputMessageModel.Angle))
            {
                float angularVelocity = 90;
                physicsRotationManager.ApplyRotation(playerEntity.rigidbody.value, inputMessageModel.Angle,
                                                     angularVelocity, physicsSimulationDuration);
            }

            //todo спавн пуль игрока
            //todo движение пуль игрока

            //симуляция физики
            scene.GetPhysicsScene().Simulate(physicsSimulationDuration);
        }
Exemplo n.º 22
0
        public void Spawn(ServerGameEntity entity)
        {
            ViewTypeEnum viewType      = entity.viewType.value;
            Vector3      spawnPosition = entity.spawnTransform.position;
            Quaternion   spawnRotation = entity.spawnTransform.rotation;
            GameObject   prefab        = prefabStorage.GetPrefab(viewType);
            GameObject   go            = physicsSpawner.Spawn(prefab, spawnPosition, spawnRotation);

            go.layer = playersLayerNumber;
            go.Link(entity);
            entity.AddView(go);
            entity.AddTransform(go.transform);
            Rigidbody rigidbody = go.GetComponent <Rigidbody>();

            entity.AddRigidbody(rigidbody);
            shootingPointsHelper.AddShootingPoints(go, entity);
            Collider[] colliders = go.GetComponents <Collider>();
            entity.AddWarshipColliders(colliders);
        }
Exemplo n.º 23
0
        public void Shoot(ServerGameEntity playerEntity, ServerInputEntity inputEntity)
        {
            if (playerEntity.hasCannonCooldown)
            {
                return;
            }

            float attackStickDirection = inputEntity.attack.direction;

            if (float.IsNaN(attackStickDirection))
            {
                return;
            }

            if (!playerEntity.hasShootingPoints)
            {
                log.Error("Если есть Attack то должен быть ShootingPoints");
                return;
            }

            //выстрел
            Transform        warshipTransform = playerEntity.transform.value;
            List <Transform> shootingPoints   = playerEntity.shootingPoints.values;

            playerEntity.ReplaceCannonCooldown(0.5f);
            foreach (var shootingTransform in shootingPoints)
            {
                //спавн пуль
                var projectileEntity = gameContext.CreateEntity();
                projectileEntity.AddTickNumber(inputEntity.creationTickNumber.value);
                projectileEntity.AddDamage(100);
                projectileEntity.AddViewType(ViewTypeEnum.DefaultShoot);
                // projectileEntity.isSpawnProjectile = true;
                Vector3 position = shootingTransform.position;
                // Debug.LogError($"shootingPoint.position {position.x} {position.y} {position.z}");
                Vector3 spawnPosition = warshipTransform.localPosition + position;
                projectileEntity.AddSpawnTransform(position, shootingTransform.rotation);
                Vector3 direction = shootingTransform.transform.rotation * Vector3.forward;
                projectileEntity.AddSpawnForce(direction.normalized * 20f);
                projectileEntity.AddParentWarship(playerEntity);
            }
        }
Exemplo n.º 24
0
        private void UpdateTransform(ServerGameEntity entity, ViewTransformCompressed viewTransform)
        {
            ushort playerId = PlayerIdStorage.PlayerEntityId;

            if (entity.id.value == playerId)
            {
                return;
            }

            Vector3 vector = viewTransform.GetPosition();

            entity.transform.value.position = vector;
            entity.transform.value.rotation = Quaternion.AngleAxis(viewTransform.Angle, Vector3.up);
            ViewTypeEnum oldViewType = entity.viewType.value;

            if (oldViewType != viewTransform.viewTypeEnum)
            {
                string mes = $"Смена типа сущности. Было {oldViewType.ToString()} стало {viewTransform.viewTypeEnum}";
                log.Debug(mes);
                entity.ReplaceViewType(viewTransform.viewTypeEnum);
            }
        }
Exemplo n.º 25
0
        public void Hit(ServerGameEntity damageEntity, ServerGameEntity warshipEntity)
        {
            ushort parentId = damageEntity.parentWarship.entity.id.value;

            if (parentId == warshipEntity.id.value)
            {
                throw new Exception("Попадание по родителю не должно считаться");
            }

            //Отнять хп
            float actualHealthPoints = warshipEntity.healthPoints.value - damageEntity.damage.value;

            warshipEntity.ReplaceHealthPoints(actualHealthPoints);

            //Пометить, если убит
            if (actualHealthPoints <= 0 && !warshipEntity.hasKilledBy)
            {
                int killerAccountId = damageEntity.parentWarship.entity.account.accountId;
                warshipEntity.AddKilledBy(killerAccountId);
            }

            //Уничтожить снаряд
            damageEntity.isDestroyed = true;
        }
Exemplo n.º 26
0
        public void SpawnPlayers(BattleRoyaleMatchModel matchModel)
        {
            Vector3 position = new Vector3();

#if ONE_PLAYER
            var firstPlayer = matchModel.GameUnits.Players.First();
            CreateWarship(position, firstPlayer.TemporaryId, firstPlayer.AccountId, ViewTypeEnum.StarSparrow1);
#else
            foreach (var player in matchModel.GameUnits.Players)
            {
                warshipSpawnerHelper.CreateWarship(position, player.TemporaryId, player.AccountId,
                                                   ViewTypeEnum.StarSparrow1);
                position = position + new Vector3(15, 0, 15);
            }

            foreach (var botModel in matchModel.GameUnits.Bots)
            {
                ServerGameEntity bot = warshipSpawnerHelper.CreateWarship(position, botModel.TemporaryId, -botModel.TemporaryId,
                                                                          ViewTypeEnum.StarSparrow1);
                bot.isBot = true;
                position  = position + new Vector3(15, 0, 15);
            }
#endif
        }
Exemplo n.º 27
0
        // public abstract GameState PastState { get; set; }
        // public abstract GameState PresentState { get; set; }

        public abstract void Execute(ServerGameEntity entity);
Exemplo n.º 28
0
        public void AddShootingPoints(GameObject go, ServerGameEntity gameEntity)
        {
            List <Transform> shootingPoints = GetShootingPoints(go.transform);

            gameEntity.AddShootingPoints(shootingPoints);
        }