public static MovementIndicatorManager CreateObject() { GameObject abilityTargetSelect = Game.Instance.UI.Common?.transform.Find("AbilityTargetSelect")?.gameObject; GameObject aoeRange = abilityTargetSelect?.GetComponent <AbilityAoERange>().Range; if (!aoeRange) { return(null); } GameObject movementIndicator = new GameObject("TurnBasedMovementIndicator"); movementIndicator.transform.SetParent(abilityTargetSelect.transform, true); MovementIndicatorManager movementIndicatorManager = movementIndicator.AddComponent <MovementIndicatorManager>(); movementIndicatorManager._rangeInner = RangeIndicatorManager.CreateObject(aoeRange, "MovementRangeInner"); movementIndicatorManager._rangeInner.VisibleColor = Color.white; DontDestroyOnLoad(movementIndicatorManager._rangeInner.gameObject); movementIndicatorManager._rangeOuter = RangeIndicatorManager.CreateObject(aoeRange, "MovementRangeOuter"); movementIndicatorManager._rangeOuter.VisibleColor = Color.white; DontDestroyOnLoad(movementIndicatorManager._rangeOuter.gameObject); return(movementIndicatorManager); }
public static AttackIndicatorManager CreateObject() { GameObject abilityTargetSelect = Game.Instance.UI.Common?.transform.Find("AbilityTargetSelect")?.gameObject; GameObject aoeRange = abilityTargetSelect?.GetComponent <AbilityAoERange>().Range; if (!aoeRange) { return(null); } GameObject attackIndicator = new GameObject("TurnBasedAttackIndicator"); attackIndicator.transform.SetParent(abilityTargetSelect.transform, true); AttackIndicatorManager attackIndicatorManager = attackIndicator.AddComponent <AttackIndicatorManager>(); attackIndicatorManager._range = RangeIndicatorManager.CreateObject(aoeRange, "AttackRange", false); DontDestroyOnLoad(attackIndicatorManager._range.gameObject); return(attackIndicatorManager); }