示例#1
0
    public override void Add_Tile(Vector3Int i_pos, TileBase i_tile)
    {
        Debug.Log("Tile added to energy");
        bool is_valid = false;

        if (tm == null)
        {
            tm = GameObject.FindGameObjectWithTag("TileManager").GetComponent <Tile_Manager>();
        }

        if (Check_Tiletype(system_tiles["Transmitters"], i_tile))
        {
            energy_dictionary.Add(i_pos, Create_Energy_Tile(i_tile));
            is_valid = true;
        }
        else if (Check_Tiletype(system_tiles["Generators"], i_tile))
        {
            Debug.Log("Generator Added");
            generator_dictionary.Add(i_pos, 1);
            is_valid = true;
        }
        else if (Check_Tiletype(system_tiles["Receptors"], i_tile))
        {
            Energy_Receptor input_receptor;

            if (tm.Check_Layer_Name(i_tile, "Wheel"))
            {
                input_receptor = new Ship_Wheel(i_pos, tm.Grab_Ship_Layer(i_tile));
            }
            else
            {
                if (is_ship_mode)
                {
                    input_receptor = new Door(i_pos, i_tile, tm.Grab_Ship_Layer(i_tile));
                }
                else
                {
                    input_receptor = new Door(i_pos, i_tile, tm.Grab_Layer(i_tile));
                }
            }

            receptor_dictionary.Add(i_pos, input_receptor);
            is_valid = true;
        }


        if (is_valid)
        {
            base.Add_Tile(i_pos, i_tile);
        }
        else
        {
            Debug.LogWarning("Invalid tile addition at:" + i_pos + " with " + i_tile);
        }
    }
示例#2
0
 public override void Add_Tile(Vector3Int i_pos, TileBase i_tile)
 {
     tm = GameObject.FindGameObjectWithTag("TileManager").GetComponent <Tile_Manager>();
     if (tm.Check_Layer_Name(i_tile, "Spawner"))
     {
         if (!swarm_dictionary.ContainsKey(i_pos))
         {
             Spawner_Info temp_spawner_info = new Spawner_Info();
             temp_spawner_info.spread_percentage = 0.0f;
             temp_spawner_info.spread_speed      = Random.Range(1.0f, 3.0f);
             temp_spawner_info.tile = i_tile;
             swarm_dictionary.Add(i_pos, temp_spawner_info);
         }
     }
 }