Esempio n. 1
0
        private void OnUnassigned_On(HooksCore.RoR2.Skills.LunarPrimaryReplacementSkill.OnUnassigned.Orig orig, LunarPrimaryReplacementSkill self, GenericSkill skillSlot)
        {
            orig(self, skillSlot);

            if (this.origCrosshairLookup.ContainsKey(self))
            {
                VisionsContextData data = this.origCrosshairLookup[self];
                if (data.origCrosshair != null)
                {
                    GameObject crosshair = skillSlot.characterBody.crosshairPrefab;
                    if (crosshair.name == this.newVisionsCrosshair.name)
                    {
                        skillSlot.characterBody.crosshairPrefab = data.origCrosshair;
                    }
                    else
                    {
                        _ = skillSlot.StartCoroutine(this.CheckCrosshairUnset(skillSlot.characterBody, data));
                    }
                }
                if (data.checkCoroutine != null)
                {
                    skillSlot.StopCoroutine(data.checkCoroutine);
                }
            }
        }
Esempio n. 2
0
        private IEnumerator CheckCrosshairUnset(CharacterBody body, VisionsContextData data)
        {
            while (true)
            {
                yield return(new WaitForSeconds(0.5f));

                if (body.crosshairPrefab.name == this.newVisionsCrosshair.name)
                {
                    body.crosshairPrefab = data.origCrosshair;
                    data.origCrosshair   = null;
                    break;
                }
            }
        }
Esempio n. 3
0
        private IEnumerator CheckCrosshairSet(CharacterBody body, VisionsContextData data)
        {
            while (true)
            {
                yield return(new WaitForSeconds(0.5f));

                if (this.badCrosshairs.Contains(body.crosshairPrefab.name) && body.crosshairPrefab.name != this.newVisionsCrosshair.name)
                {
                    data.origCrosshair   = body.crosshairPrefab;
                    body.crosshairPrefab = this.newVisionsCrosshair;
                    data.checkCoroutine  = null;
                    break;
                }
            }
        }