示例#1
0
 private void OnTouch(Contactable contact)
 {
     if (contact == Target)
     {
         SetTarget(null);
     }
 }
示例#2
0
 public void MoveTo(Contactable contact)
 {
     if (contact != null && Target != contact &&
         Vector3.Distance(transform.position, contact.transform.position) > boundaryRadius + contact.ContactRadius)
     {
         SetTarget(contact);
     }
 }
示例#3
0
文件: Radar.cs 项目: jussik/swarm
 private void RemoveContact(Contactable contact)
 {
     Contacts.Remove(contact);
     if (RadarContactEvent != null)
     {
         RadarContactEvent(this, new RadarContactArgs(contact, true));
     }
 }
示例#4
0
文件: Radar.cs 项目: jussik/swarm
 private void AddContact(Contactable contact)
 {
     Contacts.Add(contact);
     if (RadarContactEvent != null)
     {
         RadarContactEvent(this, new RadarContactArgs(contact, false));
     }
 }
示例#5
0
 private void SetTarget(Contactable contact)
 {
     if (Target != contact)
     {
         Target = contact;
         if (TargetChanged != null)
         {
             TargetChanged(this, EventArgs.Empty);
         }
     }
 }
示例#6
0
        private void OnExit(Contactable contact)
        {
            var res = contact as Resource;

            if (res != null)
            {
                AvailableTargets.Remove(res);
                if (res == Target)
                {
                    SetTarget();
                }
            }
        }
示例#7
0
        private void OnEnter(Contactable contact)
        {
            var res = contact as Resource;

            if (res != null)
            {
                AvailableTargets.Add(res);
                if (Target == null)
                {
                    SetTarget();
                }
            }
        }
 internal static HandleRef getCPtr(Contactable obj)
 {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
示例#9
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Contactable obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
示例#10
0
文件: Radar.cs 项目: jussik/swarm
 public RadarContactArgs(Contactable contact, bool removed)
 {
     Contact        = contact;
     ContactRemoved = removed;
 }