コード例 #1
0
    public static void HandleActiveEntityList(PacketReader Reader)
    {
        Log.PrintIncomingPacket("GameWorldState.HandleActiveEntityList");
        int EntityCount = Reader.ReadInt();

        for (int i = 0; i < EntityCount; i++)
        {
            //Extract each entities information as we loop through the packet data
            string  EntityType     = Reader.ReadString();
            string  EntityID       = Reader.ReadString();
            Vector3 EntityPosition = Reader.ReadVector3();
            int     EntityHealth   = Reader.ReadInt();
            //Spawn each new entity into the game world and store them in the entity manager
            GameObject   EntitySpawn   = ItemSpawner.Instance.SpawnItem(EntityPrefabs.GetEntityPrefab(EntityType), EntityPosition, Quaternion.identity);
            ServerEntity EntityDetails = EntitySpawn.GetComponent <ServerEntity>();
            EntityDetails.ID        = EntityID;
            EntityDetails.Health    = EntityHealth;
            EntityDetails.MaxHealth = EntityHealth;
            EntitySpawn.GetComponent <ServerEntity>().ID         = EntityID;
            EntitySpawn.GetComponentInChildren <TextMesh>().text = EntityType + " " + EntityDetails.Health + "/" + EntityDetails.MaxHealth;
            EntityManager.AddNewEntity(EntityID, EntitySpawn);
        }

        //Now request from the server the active item list
        //GameWorldStatePacketSender.SendActiveItemRequest();
    }
コード例 #2
0
    public EnemyEntity(string Type, string ID, Vector3 Position, Vector3 Scale, Quaternion Rotation)
    {
        this.Type     = Type;
        this.ID       = ID;
        this.Position = Position;
        this.Scale    = Scale;
        this.Rotation = Rotation;

        //Get the correct prefab for this entity type and spawn it in the scene
        this.GameObject = GameObject.Instantiate(EntityPrefabs.GetEntityPrefab(Type), Position, Rotation);
    }
コード例 #3
0
    private void Awake()
    {
        //Assign the singleton instance
        Instance = this;

        //Fill the dictionary with the prefab list
        for (int i = 0; i < EntityPrefabList.Length; i++)
        {
            GameObject PrefabObject = EntityPrefabList[i];
            string     PrefabName   = PrefabObject.transform.name;
            PrefabDictionary.Add(PrefabName, PrefabObject);
        }
    }
コード例 #4
0
        private void ConduitUpdate(float dt)
        {
            SolidConduitFlow flowManager = SolidConduit.GetFlowManager();

            if (!flowManager.HasConduit(this._inputCell) || !flowManager.HasConduit(this._outputCell) || !flowManager.IsConduitFull(this._inputCell) || (!flowManager.IsConduitEmpty(this._outputCell)))
            {
                return;
            }


            Pickupable pickupable = flowManager.RemovePickupable(_inputCell);

            flowManager.AddPickupable(this._outputCell, pickupable);
            if (!(bool)((UnityEngine.Object)pickupable))
            {
                return;
            }
            if (flowManager.HasConduit(this._filteredCell) && flowManager.IsConduitEmpty(this._filteredCell))
            {
                Pickupable pickupable2 = EntityPrefabs.Instantiate(pickupable);
                flowManager.AddPickupable(this._filteredCell, pickupable2);
            }
            this.operational.SetActive(false, false);
        }
コード例 #5
0
 public DragonAssetLoader(Transform transform, EntityPrefabs entityPrefabs)
 {
     _transform     = transform;
     _entityPrefabs = entityPrefabs;
 }
コード例 #6
0
 protected override void OnPrefabInit()
 {
     Instance = this;
 }
コード例 #7
0
 public static void DestroyInstance()
 {
     Instance = null;
 }