Пример #1
0
        private Unit ServerOrSingle_CreatePlayerUnit(PlayerManager.ServerOrSingle_Player player,
                                                     MapObject spawnPoint)
        {
            string unitTypeName;

            if (!player.Bot)
            {
                if (player.Intellect.Faction.Name == "AssaultKnights" && GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
                {
                    unitTypeName = "AKSoldier";
                }
                else if (player.Intellect.Faction.Name == "Omni" && GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
                {
                    unitTypeName = "OmniSoldier";
                }
                else if (GameMap.Instance.PlayerUnitType != null)
                {
                    unitTypeName = GameMap.Instance.PlayerUnitType.Name;
                }
                else
                {
                    unitTypeName = "Girl";
                }
            }
            else if (player.Bot)
            {
                unitTypeName = player.Name;
            }
            else
            {
                unitTypeName = "Rabbit";
            }

            Unit unit = (Unit)Entities.Instance.Create(unitTypeName, Map.Instance);

            Vec3 posOffset = new Vec3(0, 0, 1.5f);

            unit.Position = spawnPoint.Position + posOffset;
            unit.Rotation = spawnPoint.Rotation;
            unit.PostCreate();

            if (player.Intellect != null)
            {
                player.Intellect.ControlledObject = unit;
                unit.SetIntellect(player.Intellect, false);
            }

            Teleporter teleporter = spawnPoint as Teleporter;

            if (teleporter != null)
            {
                teleporter.ReceiveObject(unit, null);
            }

            //Incin -- Custom Box teleporter
            BoxTeleporter boxteleporter = spawnPoint as BoxTeleporter;

            if (boxteleporter != null)
            {
                boxteleporter.ReceiveObject(unit, null);
            }

            return(unit);
        }