Esempio n. 1
0
 public static void AddUpdateRadarPingCountInvokers(RadarPing invoker)
 {
     updateRadarPingCountInvokers.Add(invoker);
     foreach (UnityAction <Constants.Tools, int> listener in updateToolCountListeners)
     {
         invoker.AddUpdateCountRadarPingDeviceListener(listener);
     }
 }
Esempio n. 2
0
 public virtual void Activate(Actor self, Order order, SupportPowerManager manager)
 {
     if (Info.DisplayRadarPing && manager.RadarPings != null)
     {
         ping = manager.RadarPings.Value.Add(
             () => order.Player.IsAlliedWith(self.World.RenderPlayer),
             self.World.Map.CenterOfCell(order.TargetLocation),
             order.Player.Color.RGB,
             Info.RadarPingDuration);
     }
 }
Esempio n. 3
0
    private void OnTriggerEnter(Collider other)
    {
        // Pings trash on radar
        if (other.tag == "Trash")
        {
            // If the object has been already detected within half rotation of the sweep then skip
            if (!colliders.Contains(other))
            {
                RadarPing ping = Instantiate(radarPing, other.transform.position, Quaternion.Euler(90, 0, 0)).GetComponent <RadarPing>();
                ping.transform.localScale = new Vector3(5, 5, 5);
                ping.transform.parent     = radarPings.transform;
                colliders.Add(other);
            }
        }

        // Pings dock on radar
        if (other.tag == "Dock")
        {
            // If the object has been already detected within half rotation of the sweep then skip
            if (!colliders.Contains(other))
            {
                RadarPing ping = Instantiate(radarPing, new Vector3(other.transform.position.x, 0, other.transform.position.z), Quaternion.Euler(90, 0, 0)).GetComponent <RadarPing>();
                ping.SetColor(new Color(0, 1, 1, 1));
                ping.transform.localScale = new Vector3(25, 25, 25);
                ping.transform.parent     = radarPings.transform;
                colliders.Add(other);
            }
        }

        // Pings animal on radar
        if (other.tag == "Animal")
        {
            if (!colliders.Contains(other))
            {
                RadarPing ping = Instantiate(radarPing, new Vector3(other.transform.position.x, 0, other.transform.position.z), Quaternion.Euler(90, 0, 0)).GetComponent <RadarPing>();
                ping.SetColor(new Color(1, 1, 0, 1));
                ping.transform.localScale = new Vector3(30, 30, 30);
                ping.transform.parent     = radarPings.transform;
                colliders.Add(other);
            }
        }

        if (other.tag == "Obstacle")
        {
            if (!colliders.Contains(other))
            {
                RadarPing ping = Instantiate(radarPing, new Vector3(other.transform.position.x, 0, other.transform.position.z), Quaternion.Euler(90, 0, 0)).GetComponent <RadarPing>();
                ping.SetColor(new Color(1, 0, 0, 1));
                ping.transform.localScale = new Vector3(15, 15, 15);
                ping.transform.parent     = radarPings.transform;
                colliders.Add(other);
            }
        }
    }
Esempio n. 4
0
 void UpdateRadarDetection()
 {
     RaycastHit[] hits = Physics.SphereCastAll(startPosition - (transform.forward * range), range, transform.forward, 10 * range, layerToDetect);
     if (hits.Length > 0)
     {
         foreach (var hit in hits)
         {
             if (!alreadyPingedColliderList.Contains(hit.collider))
             {
                 alreadyPingedColliderList.Add(hit.collider);
                 Transform radarPingTransform = Instantiate(pfRadarPing, new Vector3(hit.collider.transform.position.x, hit.collider.transform.position.y, hit.collider.transform.position.z - (hit.collider.transform.localScale.z / 2) - 1.1f), Quaternion.identity);
                 RadarPing radarPing          = radarPingTransform.GetComponent <RadarPing>();
                 if (radarPing)
                 {
                     radarPing.SetColor(Color.white);
                 }
             }
         }
     }
 }
Esempio n. 5
0
        public void ResolveOrder(Actor self, Order order)
        {
            if (order.OrderString != "PlaceBeacon")
            {
                return;
            }

            var pos = self.World.Map.CenterOfCell(order.TargetLocation);

            self.World.AddFrameEndTask(w =>
            {
                if (playerBeacon != null)
                {
                    self.World.Remove(playerBeacon);
                }

                playerBeacon = new AnimatedBeacon(self.Owner, pos, info.Duration, info.Palette, info.IsPlayerPalette, info.BeaconImage, info.BeaconSequence);
                self.World.Add(playerBeacon);

                if (self.Owner.IsAlliedWith(self.World.RenderPlayer))
                {
                    Game.Sound.PlayNotification(self.World.Map.Rules, null, info.NotificationType, info.Notification,
                                                self.World.RenderPlayer != null ? self.World.RenderPlayer.Faction.InternalName : null);
                }

                if (radarPings != null)
                {
                    if (playerRadarPing != null)
                    {
                        radarPings.Remove(playerRadarPing);
                    }

                    playerRadarPing = radarPings.Add(
                        () => self.Owner.IsAlliedWith(self.World.RenderPlayer),
                        pos,
                        self.Owner.Color.RGB,
                        info.Duration);
                }
            });
        }