Beispiel #1
0
        public void UpdatePower()
        {
            if (m_InfinitePower)
            {
                m_CurrentPower = 1.0f;
            }
            else
            {
                m_CurrentPower = Mathf.Max(m_CurrentPower - 0.1f, 0.0f);
            }

            foreach (var conduit in m_Connected)
            {
                PowerConduitPower other = null;
                var gop = new TwoDee.ProxyWorld.GameObjectOrProxy(conduit);
                if (gop.GameObject != null)
                {
                    var pc = gop.GameObject.GetComponentInParent <PowerConduit>();
                    other = pc.m_Pcp;
                }
                else if (gop.Proxy != null)
                {
                    var pc = gop.Proxy.GetData <PowerConduit.Proxy>();
                    if (pc != null)
                    {
                        other = pc.m_Pcp;
                    }
                }

                if (other != null)
                {
                    other.m_CurrentPower = Mathf.Max(other.m_CurrentPower, m_CurrentPower);
                }
            }
        }
Beispiel #2
0
 protected override void SaveLoad(bool save, PowerConduit comp)
 {
     if (save)
     {
         // Let all connected ropes know we're going away since they need to go away too (or else the physics will fail and the rope will fall from this side)
         m_Pcp = comp.m_Pcp;
     }
     else
     {
         comp.m_Pcp = m_Pcp;
     }
 }