void ToggleMiniLights(MiniCopter mini)
 {
     foreach (var light in mini.GetComponentsInChildren <SearchLight>())
     {
         ToggleFLight(light);
     }
 }
Esempio n. 2
0
        private object CanSamSiteShoot(SamSite samSite)
        {
            if (samSite == null)
            {
                return(false);
            }

            List <BasePlayer> targetPlayers = new List <BasePlayer>();

            switch (samSite.currentTarget.prefabID)
            {
            case 2278499844:     //minicopter
                MiniCopter      targetCopter = samSite.currentTarget as MiniCopter;
                BaseVehicleSeat driverSeat   = null;
                //if (targetCopter == null) PrintToChat("copter not found");
                if (targetCopter != null)
                {
                    driverSeat = targetCopter.GetComponentsInChildren <BaseVehicleSeat>()[0];
                }
                //if (driverSeat == null) PrintToChat("seat not found");
                if (driverSeat != null)
                {
                    targetPlayers.Add(driverSeat._mounted);
                }
                break;

            case 3111236903:     //hotairballoon
                HotAirBalloon targetBalloon = samSite.currentTarget as HotAirBalloon;
                Vis.Entities(targetBalloon.transform.position, 2, targetPlayers);
                break;

            default:
                return(false);
            }

            if (targetPlayers.Count == 0)
            {
                return(null);
            }

            //calculate distance
            float distance = Vector3.Distance(samSite.transform.position, samSite.currentTarget.transform.position);

            //warning
            if (distance > firingRange)
            {
                foreach (var player in targetPlayers)
                {
                    //player.ChatMessage(warningMsg);
                    GUIAnnouncements?.Call("CreateAnnouncement", getCustomMsg(false, samSite.GetInstanceID()), "grey", "white", player);
                    return(false);
                }
            }

            //firing
            else
            {
                foreach (var player in targetPlayers)
                {
                    //player.ChatMessage(firingMsg);
                    GUIAnnouncements?.Call("CreateAnnouncement", getCustomMsg(true, samSite.GetInstanceID()), "red", "white", player);
                    return(null);
                }
            }
            return(false);
        }