public PingSkin(Color pingColor, Color textColor, Color spriteColor, Sprite sprite, float duration, string chatToken, PingIndicator.PingType pingType, Highlight.HighlightColor highlightColor, float highlightStrength)
     : this(pingColor, textColor, spriteColor, sprite, duration, chatToken, pingType)
 {
     this.doHighlight       = true;
     this.highlightColor    = highlightColor;
     this.highlightStrength = highlightStrength;
 }
 public PingSkin(Color color, Sprite sprite, float duration, string chatToken, PingIndicator.PingType pingType)
 {
     this.pingColor         = color;
     this.textColor         = color;
     this.spriteColor       = color;
     this.sprite            = sprite;
     this.duration          = duration;
     this.chatToken         = chatToken;
     this.basePingType      = pingType;
     this.doHighlight       = false;
     this.highlightColor    = Highlight.HighlightColor.unavailable;
     this.highlightStrength = 0f;
 }
        public void ManualBuildPing(GameObject targetObject, Vector3 origin, Vector3 targetNormal, string ownerText, string chatText, Color pingColor, Color textColor, Color spriteColor, Sprite sprite, float duration, PingIndicator.PingType basePingType, bool doHighlight, Highlight.HighlightColor highlightColor, float highlightStrength)
        {
            var pmit = owner.GetComponent <PingMenuInstanceTracker>();

            if (!pmit)
            {
                pmit = owner.gameObject.AddComponent <PingMenuInstanceTracker>();
            }
            pmit.currentPingIsCustom = true;

            if (owner.pingerController.pingIndicator)
            {
                GameObject.Destroy(owner.pingerController.pingIndicator.gameObject);
            }

            //normal setup
            //var pingIndObj = GameObject.Instantiate(RadialPingsPlugin.customPingIndicatorPrefab);
            var pingIndObj = GameObject.Instantiate(Resources.Load <GameObject>("prefabs/PingIndicator"));
            var pingInd    = pingIndObj.GetComponent <PingIndicator>();

            owner.pingerController.pingIndicator           = pingInd;
            owner.pingerController.pingIndicator.pingOwner = owner.pingerController.gameObject;

            pingInd.pingOrigin         = origin;
            pingInd.pingNormal         = targetNormal;
            pingInd.pingTarget         = targetObject;
            pingInd.pingHighlight.isOn = false;
            pingInd.positionIndicator.targetTransform = null;

            if (targetObject)
            {
                if (pingInd.pingOrigin == null)
                {
                    pingInd.pingOrigin = targetObject.transform.position;
                }
                var targetBody     = targetObject.GetComponent <CharacterBody>();
                var targetModelLoc = targetObject.GetComponent <ModelLocator>();
                var targetModel    = targetModelLoc?.modelTransform?.GetComponent <CharacterModel>();
                if (targetBody)
                {
                    pingInd.targetTransformToFollow = targetBody.coreTransform;
                }
                pingInd.transform.position = targetObject.transform.position;
                pingInd.positionIndicator.targetTransform = targetObject.transform;

                if (doHighlight)
                {
                    Renderer targetRenderer = null;
                    if (targetBody && targetModel)
                    {
                        foreach (var renInfo in targetModel.baseRendererInfos)
                        {
                            if (!renInfo.ignoreOverlays)
                            {
                                targetRenderer = renInfo.renderer;
                                break;
                            }
                        }
                    }
                    else if (!targetBody)
                    {
                        targetRenderer = targetModelLoc?.modelTransform?.GetComponentInChildren <Renderer>() ?? targetObject.GetComponentInChildren <Renderer>();
                    }

                    if (targetRenderer != null)
                    {
                        pingInd.pingHighlight.highlightColor = highlightColor;
                        pingInd.pingHighlight.targetRenderer = targetRenderer;
                        pingInd.pingHighlight.strength       = highlightStrength;
                        pingInd.pingHighlight.isOn           = true;
                    }
                }
            }
            else
            {
                pingInd.transform.position = origin;
            }
            pingInd.transform.rotation   = Util.QuaternionSafeLookRotation(targetNormal);
            pingInd.transform.localScale = Vector3.one;
            pingInd.positionIndicator.defaultPosition = pingInd.transform.position;
            pingInd.pingType = PingIndicator.PingType.Default;
            pingInd.pingObjectScaleCurve.enabled = false;
            pingInd.pingObjectScaleCurve.enabled = true;
            foreach (var obj in pingInd.interactablePingGameObjects)
            {
                obj.SetActive(false);
            }
            foreach (var obj in pingInd.enemyPingGameObjects)
            {
                obj.SetActive(false);
            }
            foreach (var obj in pingInd.defaultPingGameObjects)
            {
                obj.SetActive(false);
            }

            GameObject[] listToSetup;
            switch (basePingType)
            {
            case PingIndicator.PingType.Enemy:
                listToSetup = pingInd.enemyPingGameObjects;
                break;

            case PingIndicator.PingType.Interactable:
                listToSetup = pingInd.interactablePingGameObjects;
                break;

            default:
                listToSetup = pingInd.defaultPingGameObjects;
                break;
            }
            foreach (var obj in listToSetup)
            {
                obj.SetActive(true);
            }

            pingInd.pingText.enabled = true;
            pingInd.pingText.text    = ownerText;
            pingInd.pingColor        = pingColor;
            pingInd.defaultPingColor = pingColor;
            pingInd.pingDuration     = duration;
            pingInd.pingText.color   = textColor;
            pingInd.fixedTimer       = duration;

            if (chatText != null)
            {
                Chat.AddMessage(chatText);
            }

            //BoingyScaler setup
            listToSetup[0].GetComponent <SpriteRenderer>().sprite = sprite;
            listToSetup[0].GetComponent <SpriteRenderer>().color  = spriteColor;
            var psmain = listToSetup[1].GetComponent <ParticleSystem>().main;

            psmain.startColor = pingColor;
        }