GameEntities.Unit.SetIntellect C# (CSharp) Method

SetIntellect() public method

public SetIntellect ( Intellect value, bool shouldDeleteAfterDetach ) : void
value Intellect
shouldDeleteAfterDetach bool
return void
        public void SetIntellect( Intellect value, bool shouldDeleteAfterDetach )
        {
            Intellect oldIntellect = intellect;
            bool oldIntellectShouldDeleteAfterDetach = intellectShouldDeleteAfterDetach;

            if( intellect != null )
                RemoveRelationship( intellect );

            intellect = value;
            intellectShouldDeleteAfterDetach = shouldDeleteAfterDetach;

            if( intellect != null )
                AddRelationship( intellect );

            if( oldIntellect != null && oldIntellectShouldDeleteAfterDetach )
                oldIntellect.SetShouldDelete();

            //send update to clients
            if( EntitySystemWorld.Instance.IsServer() )
                Server_SendIntellectToClients( EntitySystemWorld.Instance.RemoteEntityWorlds );
        }

Usage Example

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

            if (!player.Bot)
            {
                unitTypeName = "Forklift";
            }
            else
            {
                unitTypeName = player.Name;
            }

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

            Vec3 posOffset = new Vec3(0, 0, 1.5f);              //!!!!temp

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

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

            return(unit);
        }
All Usage Examples Of GameEntities.Unit::SetIntellect