示例#1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="entity"></param>
    public void LoadEntity(Entity entity)
    {
        if (!entity.IsAlive)
        {
            return;
        }
        Debug.Log("Entity Pref: " + entity.GetEntityGameObject());

        LoadedEntity loadedEntity = Instantiate(entity.GetEntityGameObject()).GetComponent <LoadedEntity>();

        loadedEntity.gameObject.name             = entity.Name;
        loadedEntity.gameObject.transform.parent = transform;

        loadedEntity.SetEntity(entity);
        entity.OnEntityLoad(loadedEntity);
        //Ensure entities last chunk is set.
        entity.SetLastChunk(World.GetChunkPosition(entity.Position));

        LoadedEntities.Add(loadedEntity);
        //UpdateEntityChunk(entity, null, World.GetChunkPosition(entity.Position));

        if (entity is NPC)
        {
            Debug.Log("Loading " + entity.Name + " from chunk " + World.GetChunkPosition(entity.Position));
        }
    }
示例#2
0
    public void SetPlayer(Player player)
    {
        GameObject entityObject = Instantiate(player.GetEntityGameObject());

        entityObject.name             = "Player";
        entityObject.transform.parent = transform;

        LoadedEntity loadedEntity = entityObject.GetComponent <LoadedEntity>();

        player.OnEntityLoad(loadedEntity, true);
        loadedEntity.SetEntity(player);
        entityObject.transform.position = player.Position;
        loadedEntity.SetLookBasedOnMovement(false);
        Player = player;
        //Player.CombatManager.AddSpell(new SpellFireball(), 0);
        Player.CombatManager.SpellManager.AddSpell(new SpellStoneWall(), 0);


        Player.Inventory.AddItem(new SteelLongSword());
        Player.Inventory.AddItem(new SimpleDungeonKey(0));
        //Player.Inventory.AddItem(new SteelLegs());
        Player.EquiptmentManager.AddDefaultItem(new Trousers());
        Player.EquiptmentManager.AddDefaultItem(new Shirt());
        // Player.EquiptmentManager.AddDefaultItem(new Trousers());
        LoadedPlayer = loadedEntity;


        if (TestMain.TEST_MODE)
        {
        }
        else
        {
        }
    }
示例#3
0
    public void LoadEntity(Entity entity)
    {
        GameObject entityObject = Instantiate(entity.GetEntityGameObject());

        entityObject.name             = entity.Name;
        entityObject.transform.parent = transform;

        LoadedEntity loadedEntity = entityObject.GetComponent <LoadedEntity>();

        loadedEntity.SetEntity(entity);
        entity.OnEntityLoad(loadedEntity);
        LoadedEntities.Add(loadedEntity);

        if (entity is NPC)
        {
            Debug.Log("Loading " + entity.Name + " from chunk " + World.GetChunkPosition(entity.Position), Debug.ENTITY_TEST);
        }
    }