Terrarium.Game.GameEngine.Teleport C# (CSharp) Method

Teleport() public method

Can be called with an OrganismState that needs to be teleported. Cannot be called during MoveAnimals since it passes true to the clearOld argument in RemoveOrganism.
public Teleport ( OrganismState state ) : void
state OrganismState The state of the creature to be teleported.
return void
        public void Teleport(OrganismState state)
        {
            if (null == state)
            {
                throw new Exception("Null object passed into Teleport");
            }

            TeleportState teleportState = new TeleportState();

            Organism organism = Scheduler.GetOrganism(state.ID);
            state.MakeImmutable();
            teleportState.OrganismState = state;
            teleportState.Organism = organism;
            teleportState.OrganismWrapper = new OrganismWrapper(organism);
            teleportState.Originator = _newWorldState.StateGuid;
            teleportState.Country = GameConfig.UserCountry;
            teleportState.State = GameConfig.UserState;

            // Remove it from this world
            removeOrganism(new KilledOrganism(state.ID, PopulationChangeReason.TeleportedFrom));

            // Teleport the organism through the network engine
            if (_usingNetwork)
            {
                _networkEngine.Teleport(teleportState);
            }
            else
            {
                ReceiveTeleportation(teleportState, true);
            }
        }