示例#1
0
    private void DeleteEntity(Entity.SerializableEntity serializableEntity)
    {
        var map    = campaign.activeMap;
        var entity = map.entities.FirstOrDefault(x => x.id == serializableEntity.id);

        if (entity == null)
        {
            return;
        }

        map.entities.Remove(entity);
        map.selectedEntities.Remove(entity);
        Destroy(entity.gameObject);
    }
示例#2
0
    private void ChangeEntity(Entity.SerializableEntity serializableEntity)
    {
        var map    = campaign.activeMap;
        var entity = map.entities.FirstOrDefault(x => x.id == serializableEntity.id);

        if (entity == null)
        {
            entity     = Instantiate(entityPrefab, map.entitiesParent).GetComponent <Entity>();
            entity.map = map;
            map.entities.Add(entity);
        }
        entity.Deserialize(serializableEntity);

        foreach (var e in map.entities.Where(x => x.SharedVision))
        {
            e.ResetVision();
        }
    }