Example #1
0
        Unit ServerOrSingle_CreatePlayerUnit(PlayerManager.ServerOrSingle_Player player,
                                             MapObject spawnPoint)
        {
            string unitTypeName;

            if (!player.Bot)
            {
                if (GameMap.Instance.PlayerUnitType != null)
                {
                    unitTypeName = GameMap.Instance.PlayerUnitType.Name;
                }
                else
                {
                    unitTypeName = "Girl";
                }
            }
            else
            {
                unitTypeName = player.Name;
            }

            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);
            }

            return(unit);
        }
        private void DoTransfer()
        {
            Set <MapObject> objects = GetObjectsInActiveArea();

            if (objectWhichActivatesTransition != null && !objectWhichActivatesTransition.IsSetForDeletion)
            {
                objects.AddWithCheckAlreadyContained(objectWhichActivatesTransition);
            }

            foreach (MapObject obj in objects)
            {
                if (!string.IsNullOrEmpty(changeMapName))
                {
                    TransferToAnotherMap(obj);
                }
                else if (destination != null)
                {
                    destination.ReceiveObject(obj, this);
                }
            }

            teleportTransitProgress        = 0;
            objectWhichActivatesTransition = null;
        }
Example #3
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);
        }