Пример #1
0
    /// <summary>
    /// 开始连接
    /// </summary>
    public void StartConnected()
    {
        TransferModel transfer = gameObject.GetComponent <TransferModel>();
        EnergyManage  manage   = GameObject.FindObjectOfType <EnergyManage>();

        transfer.isUse = true;
        if (transfer.energys.Count > 0)
        {
            string gridName = transfer.GridConnected(transfer, transfer.GetUUUID());
            if (gridName != null)
            {
                gameObject.name = gridName;
                isConnected     = true;

                if (isOpen && nowPower == 0)
                {
                    nowPower = manage.Output(gameObject.name, ratedPower);
                }
            }
        }
    }
Пример #2
0
 public void StartSupply() {
     TransferModel transfer = gameObject.GetComponent<TransferModel>();
     EnergyManage manage = FindObjectOfType<EnergyManage>();
     transfer.isSupply = true;
     if (transfer.energys.Count == 0)
     {
         gameObject.name = manage.GetGridName();           
     }
     else
     {
         string gridName= transfer.GridConnected(transfer, transfer.GetUUUID());
         if (gridName==null)
         {
             gameObject.name = manage.GetGridName();
         }
         else
         {
             gameObject.name = gridName;
           
         } 
     }
     manage.Input(gameObject.name, outputPower);
 }