Esempio n. 1
0
 public override void NeedPower(Relay relay)
 {
     if (nodes.Count != 0)
     {
         foreach (var node in nodes)
         {
             node.NeedPower(relay);
         }
     }
 }
Esempio n. 2
0
 public override void NeedPower(Relay relay)
 {
     if (residual > (relay.ratedPower - relay.nowPower))
     {
         residual       -= (relay.ratedPower - relay.nowPower);
         relay.nowPower += (relay.ratedPower - relay.nowPower);
         relay.StopCoroutine(relay.scan);
     }
     else
     {
         relay.nowPower += residual;
         residual        = 0;
     }
 }
Esempio n. 3
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.gameObject.layer == AppManage.Instance.BuildLayer)//图层为build
     {
         //if (collision.gameObject.GetComponent<Relay>() != null)
         //{
         //    nodes.Remove(collision.gameObject.GetComponent<Relay>());
         //}
         if (collision.gameObject.GetComponent <Source>() != null)
         {
             nodes.Remove(collision.gameObject.GetComponent <Source>());
         }
         Relay relay = collision.gameObject.GetComponent <Relay>();
         if (relay != null)
         {
             relay.node = null;
         }
     }
 }
Esempio n. 4
0
 private void OnTriggerEnter2D(Collider2D collision)                  //将范围内发用点加入node
 {
     if (collision.gameObject.layer == AppManage.Instance.BuildLayer) //图层为build
     {
         //if (collision.gameObject.GetComponent<Relay>()!=null)
         //{
         //    nodes.Add(collision.gameObject.GetComponent<Relay>());
         //}
         if (collision.gameObject.GetComponent <Source>() != null)
         {
             nodes.Add(collision.gameObject.GetComponent <Source>());
         }
         Relay relay = collision.gameObject.GetComponent <Relay>();
         if (relay != null)
         {
             relay.node = this;
         }
         //  collision.gameObject.GetComponent<BuildControl>().TryConnect();
     }
 }
Esempio n. 5
0
 public virtual void NeedPower(Relay relay)
 {
 }