Exemplo n.º 1
0
 public ImageData(string name, string sprite, SpriteManager.SpriteType type, bool active)
 {
     Name        = name;
     Sprite_Name = sprite;
     Sprite_Type = type;
     Active      = active;
 }
Exemplo n.º 2
0
 public SpriteData(string name, SpriteManager.SpriteType type)
 {
     Name = name;
     Type = type;
     Animation_Frame_Time = 0.0f;
     Animation_Sprites    = new List <string>();
 }
Exemplo n.º 3
0
 public SpriteData(SpriteManager.SpriteType type, List <string> animation_sprites, float animation_fps)
 {
     Name = animation_sprites[0];
     Type = type;
     Animation_Frame_Time = 1.0f / animation_fps;
     Animation_Sprites    = animation_sprites;
 }
Exemplo n.º 4
0
    //TODO: internal_name.Contains("_slope")
    public Block(string name, string internal_name, string material, string model_name, bool passable, bool can_be_built_over, bool inactive, int hp, string ui_sprite, SpriteManager.SpriteType ui_sprite_type, float dismantle_speed,
                 float build_speed, Dictionary <string, int> dismantle_drops, Dictionary <string, int> building_materials, Dictionary <Skill.SkillId, int> dismantle_skills, Dictionary <Skill.SkillId, int> build_skills,
                 Verb dismantle_verb, Dictionary <Tool.ToolType, int> tools_required_to_dismantle, Dictionary <Tool.ToolType, int> tools_required_to_build, BuildMenuManager.TabType?build_menu_tab, float harvest_speed,
                 string after_harvest_prototype, Dictionary <string, int> harvest_drops, Dictionary <Skill.SkillId, int> skills_required_to_harvest, Dictionary <Tool.ToolType, int> tools_required_to_harvest, Verb harvest_verb,
                 CreateDelegate create_action, UpdateDelegate update_action, ConnectionData connections, bool base_support, bool destroy_group_when_removed) :
        base(name, string.IsNullOrEmpty(model_name) ? (internal_name.Contains("_slope") ? SLOPE_PREFAB_NAME : PREFAB_NAME) : null, string.IsNullOrEmpty(model_name) ? material : null, MaterialManager.MaterialType.Block, model_name)
    {
        Id                  = -1;
        Name                = name;
        Internal_Name       = internal_name;
        Material            = material;
        Passable            = passable;
        Can_Be_Built_Over   = can_be_built_over;
        Inactive_GameObject = inactive;
        MAX_HP              = hp;
        Indestructible      = hp <= 0.0f;
        HP                  = -1.0f;
        HP_Dismantled       = -1.0f;
        HP_Built            = -1.0f;
        UI_Sprite           = ui_sprite;
        UI_Sprite_Type      = ui_sprite_type;
        Dismantle_Speed     = dismantle_speed;
        Build_Speed         = build_speed;
        Dismantle_Drops     = dismantle_drops != null?Helper.Clone_Dictionary(dismantle_drops) : new Dictionary <string, int>();

        Materials_Required_To_Build = building_materials != null?Helper.Clone_Dictionary(building_materials) : new Dictionary <string, int>();

        Skills_Required_To_Dismantle = dismantle_skills != null?Helper.Clone_Dictionary(dismantle_skills) : new Dictionary <Skill.SkillId, int>();

        Skills_Required_To_Build = build_skills != null?Helper.Clone_Dictionary(build_skills) : new Dictionary <Skill.SkillId, int>();

        Dismantle_Verb = new Verb(dismantle_verb);
        Tools_Required_To_Dismantle = tools_required_to_dismantle != null?Helper.Clone_Dictionary(tools_required_to_dismantle) : new Dictionary <Tool.ToolType, int>();

        Tools_Required_To_Build = tools_required_to_build != null?Helper.Clone_Dictionary(tools_required_to_build) : new Dictionary <Tool.ToolType, int>();

        Completed               = true;
        Build_Menu_Tab          = build_menu_tab;
        Harvest_Speed           = harvest_speed;
        After_Harvest_Prototype = after_harvest_prototype;
        Harvest_Progress        = -1.0f;
        Harvest_Drops           = harvest_drops != null?Helper.Clone_Dictionary(harvest_drops) : new Dictionary <string, int>();

        Skills_Required_To_Harvest = skills_required_to_harvest != null?Helper.Clone_Dictionary(skills_required_to_harvest) : new Dictionary <Skill.SkillId, int>();

        Tools_Required_To_Harvest = tools_required_to_harvest != null?Helper.Clone_Dictionary(tools_required_to_harvest) : new Dictionary <Tool.ToolType, int>();

        Harvest_Verb               = new Verb(harvest_verb);
        Data                       = new Dictionary <string, object>();
        Persistent_Data            = new Dictionary <string, object>();
        Update_Action              = update_action;
        update_cooldown            = -1.0f;
        Create_Action              = create_action;
        Connections                = new ConnectionData(connections);
        last_connections           = new ConnectionData(connections);
        Base_Support               = base_support;
        Base_Pilar_Support         = false;
        Destroy_Group_When_Removed = destroy_group_when_removed;
        Groups                     = new List <BlockGroup>();
    }
Exemplo n.º 5
0
 public UIElementData(string gameobject_name, string sprite_name, SpriteManager.SpriteType sprite_type)
 {
     GameObject_Name = gameobject_name;
     Text            = null;
     On_Click        = null;
     Sprite_Name     = sprite_name;
     Sprite_Type     = sprite_type;
 }
Exemplo n.º 6
0
 public UIElementData(string gameobject_name, string button_text, OnClickDelegate on_click)
 {
     GameObject_Name = gameobject_name;
     Text            = button_text;
     On_Click        = on_click;
     Sprite_Name     = null;
     Sprite_Type     = SpriteManager.SpriteType.UI;
 }
Exemplo n.º 7
0
 public UIElementData(string gameobject_name, string text, Color?color = null)
 {
     GameObject_Name = gameobject_name;
     Text            = text;
     On_Click        = null;
     Text_Color      = color;
     Sprite_Name     = null;
     Sprite_Type     = SpriteManager.SpriteType.UI;
 }
Exemplo n.º 8
0
 public Notification(string name, string sprite, SpriteManager.SpriteType sprite_type, NotificationManager.Notification_On_Click on_click)
 {
     Id = current_id;
     current_id++;
     Name        = name;
     Sprite      = sprite;
     Sprite_Type = sprite_type;
     On_Click    = on_click;
 }
Exemplo n.º 9
0
 public Item(string name, string internal_name, int durability, float weight, float volyme, string ui_sprite, SpriteManager.SpriteType ui_sprite_type)
 {
     Name           = name;
     Internal_Name  = internal_name;
     Durability     = -1;
     Max_Durability = durability;
     Weight         = weight;
     Volyme         = volyme;
     UI_Sprite      = ui_sprite;
     UI_Sprite_Type = ui_sprite_type;
 }
Exemplo n.º 10
0
 private Resource(ResourceType type, string ui_name, string sprite_name, SpriteManager.SpriteType sprite_type, FoodType food_type, float food_quality, float value, ResourceRarity rarity, List <ResourceTag> tags)
 {
     Type         = type;
     UI_Name      = ui_name;
     Sprite_Name  = sprite_name;
     Sprite_Type  = sprite_type;
     Food_Type    = food_type;
     Food_Quality = food_quality;
     Value        = value;
     Fuel_Value   = 0.0f;
     Rarity       = rarity;
     Tags         = tags;
 }
Exemplo n.º 11
0
    public void OpenDoor()
    {
        SpriteManager.SpriteType mySpriteType = GetComponent <Tile>().mySpriteType;

        GetComponent <Tile>().myType = Tile.TileType.DoorOpen;

        if (mySpriteType == SpriteManager.SpriteType.DoorHorizontalClosed)
        {
            GetComponentInChildren <SpriteRenderer>().sprite = SpriteManager.instance.CreateTexture(SpriteManager.SpriteType.DoorHorizontalOpen);
        }
        else if (mySpriteType == SpriteManager.SpriteType.DoorVerticalClosed)
        {
            GetComponentInChildren <SpriteRenderer>().sprite = SpriteManager.instance.CreateTexture(SpriteManager.SpriteType.DoorVerticalOpen);
        }

        // sound effects
        SoundManager.instance.PlaySound(SoundManager.Sound.OpenDoor);
    }
Exemplo n.º 12
0
    public CraftingRecipe(string name, string internal_name, float time, CraftingMenuManager.TabType tab, Dictionary <string, int> inputs, Dictionary <string, int> outputs, Dictionary <Tool.ToolType, int> required_tools,
                          Dictionary <Skill.SkillId, int> required_skills, string icon_sprite, SpriteManager.SpriteType icon_sprite_type)
    {
        Id = current_id;
        current_id++;
        Name          = name;
        Internal_Name = internal_name;
        Time          = time;
        Tab           = tab;
        Inputs        = inputs != null?Helper.Clone_Dictionary(inputs) : new Dictionary <string, int>();

        Outputs = outputs != null?Helper.Clone_Dictionary(outputs) : new Dictionary <string, int>();

        Required_Tools = required_tools != null?Helper.Clone_Dictionary(required_tools) : new Dictionary <Tool.ToolType, int>();

        Required_Skills = required_skills != null?Helper.Clone_Dictionary(required_skills) : new Dictionary <Skill.SkillId, int>();

        Icon_Sprite      = icon_sprite;
        Icon_Sprite_Type = icon_sprite_type;
    }
Exemplo n.º 13
0
 public Tool(string name, string internal_name, int durability, float weight, float volyme, string ui_sprite, SpriteManager.SpriteType ui_sprite_type, ToolType type, int level, float efficiency) :
     base(name, internal_name, durability, weight, volyme, ui_sprite, ui_sprite_type)
 {
     Type            = type;
     Level           = level;
     Base_Efficiency = efficiency;
 }
Exemplo n.º 14
0
    public static void Set_Image(string parent_game_object_name, string text_game_object_name, string sprite_name, SpriteManager.SpriteType sprite_type, Color color)
    {
        GameObject image_game_object = GameObject.Find(string.Format("{0}/{1}", parent_game_object_name, text_game_object_name));
        Image      image             = image_game_object.GetComponentInChildren <Image>();

        image.sprite = SpriteManager.Instance.Get(sprite_name, sprite_type);
        image.color  = color;
    }
Exemplo n.º 15
0
    private void Finish()
    {
        if (NewExpeditionGUIManager.Instance.Active && NewExpeditionGUIManager.Instance.Expedition == this)
        {
            NewExpeditionGUIManager.Instance.Active = false;
        }
        City.Instance.Remove_Expedition(this);
        Building harbor = City.Instance.Buildings.FirstOrDefault(x => x.Id == Building_Id);

        if (Goal == ExpeditionGoal.Collect_Resources)
        {
            if (harbor == null)
            {
                return;
            }
            int             additional_chance = 50;
            List <Resource> found_resources   = new List <Resource>()
            {
                Resource
            };
            float amount = Get_Random_Resource_Amount(Resource);
            switch (Lenght)
            {
            case ExpeditionLenght.Short:
                additional_chance = 20;
                break;

            case ExpeditionLenght.Long:
                additional_chance = 80;
                break;
            }
            Store_Resources(harbor, Resource, amount);
            while (RNG.Instance.Next(0, 100) <= additional_chance)
            {
                Resource extra = Get_Random_Resource(Resource, found_resources);
                if (extra == null)
                {
                    break;
                }
                Store_Resources(harbor, extra, Get_Random_Resource_Amount(extra) * 0.35f);
                found_resources.Add(extra);
                additional_chance /= 2;
            }
        }
        else if (Goal == ExpeditionGoal.Find_Colony_Locations)
        {
            City.Instance.Add_Colony_Location(new ColonyLocation(Resource));
        }
        else if (Goal == ExpeditionGoal.Establish_Colony)
        {
            Contacts.Instance.Cities.Add(new ForeignCity(Colony_Data));
        }
        if (harbor != null)
        {
            harbor.Lock_Workers = false;
            Building dock   = City.Instance.Buildings.FirstOrDefault(x => x.Id == long.Parse(harbor.Data["dock_id"]));
            string   sprite = dock != null ? dock.Sprite.Name : harbor.Sprite.Name;
            SpriteManager.SpriteType sprite_type = dock != null ? dock.Sprite.Type : harbor.Sprite.Type;
            NotificationManager.Instance.Add_Notification(new Notification("Expedition finished", sprite, sprite_type, delegate() {
                CameraManager.Instance.Set_Camera_Location(harbor.Tile.Coordinates.Vector);
                InspectorManager.Instance.Building = harbor;
            }));
        }
    }