Exemplo n.º 1
0
    public void SaveTemplate()
    {
        var regionMapWindow = UIMainController.Instance.GetWindow <UIRegionMapWindow>(UIConstants.WINDOW_REGION_MAP);
        var toolsContainer  = regionMapWindow.ToolsPanel.GetToolsContainer <UIWindToolsContainer>();

        toolsContainer.AddTool(WindmillItem.Copy(m_Target.Origin));
    }
Exemplo n.º 2
0
    public override void OnBeginDrag(PointerEventData eventData)
    {
        var mouseCoordinates = MapCoordinateHelper.ConvertToCoordinates(m_Source.MinCoords,
                                                                        m_Source.MaxCoords,
                                                                        eventData.position);

        m_OriginTemplate.Coordinates = mouseCoordinates;
        targetObject          = m_Source.Create(WindmillItem.Copy(m_OriginTemplate));
        targetObject.Dragable = true;
        base.OnBeginDrag(eventData);
    }
    public static float GetEnergyNow(WindmillItem origin)
    {
        var airDensity = origin.pressure * ToPascal * M / (R * (origin.temperature));
        var square     = Mathf.PI * Mathf.Pow(origin.radius, 2);

        var windSpeed = origin.windSpeed * Mathf.Pow(origin.heightWindmill / heightMeteo, alpha);

        var totalEnergy = (origin.efficiency / 100f) * airDensity * Mathf.Pow(windSpeed, 3) * square / 2f;

        return(totalEnergy);
    }
    public void AddTool(WindmillItem item)
    {
        var wind = Tools.Find(x => x.OriginTemplate == item);

        if (wind == null)
        {
            var clonedTool = Instantiate(m_Template, root);
            clonedTool.targetObject   = null;
            clonedTool.OriginTemplate = item;
            Tools.Add(clonedTool);
        }
    }