private static GameObject GetEffect(string effectName, string spellId = "", bool isMoveable = false) { GameObject result; if (isMoveable) { result = Instances.GetMoveableSpell(spellId, effectName); if (result == null) { Log.Error($"Moveable spell {spellId}.{effectName} not found!"); } else { Log.Warning($"Moveable spell {spellId}.{effectName} FOUND!"); return(result); } } string prefabName = Effects.GetIndividualEffectName(EffectParameters.GetEffectNameOnly(effectName)); Log.Debug($"GetEffect() - prefabName = \"{prefabName}\""); if (Prefabs.Has(prefabName)) { Log.Debug($"Cloning..."); result = Prefabs.Clone(effectName); } else { Log.Debug($"CompositeEffect.CreateKnownEffect(\"{effectName}\")"); result = CompositeEffect.CreateKnownEffect(effectName); } PrepareEffect(result); return(result); }
private static void AddSpinLock(GameObject adornmentsParent) { GameObject spinLock = Prefabs.Clone(STR_SpinLockIndicator); spinLock.name = STR_SpinLockIndicator; spinLock.transform.SetParent(adornmentsParent.transform); spinLock.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); spinLock.transform.localPosition = new Vector3(0, -0.7f, 0); spinLock.transform.localEulerAngles = new Vector3(0, 0, 0); }
public static CreatureBoardAsset SetActiveTurn(string creatureId, string color) { Log.Debug($"SetActiveTurn..."); ClearActiveTurnIndicator(); CreatureBoardAsset creatureAsset = GetCreatureBoardAsset(creatureId); if (creatureAsset == null) { Log.Error($"SetActiveTurn - creatureId {creatureId} not found."); return(null); } GameObject baseGameObject = creatureAsset.GetBase(); if (baseGameObject == null) { Log.Error($"SetActiveTurn - baseGameObject for {creatureId} not found."); return(null); } string effectName; if (creatureAsset.CreatureScale == 2) { effectName = "ActiveTurn2x2"; } else if (creatureAsset.CreatureScale == 3) { effectName = "ActiveTurn3x3"; } else if (creatureAsset.CreatureScale == 4) { effectName = "ActiveTurn4x4"; } else if (creatureAsset.CreatureScale == 0.5) { effectName = "ActiveTurn0.5x0.5"; } else { effectName = "ActiveTurn1x1"; } Log.Debug($"activeTurnIndicator = Prefabs.Clone(\"{effectName}\");"); activeTurnIndicator = Prefabs.Clone(effectName); if (activeTurnIndicator == null) { Log.Error($"SetActiveTurn - Prefabs.Clone(\"{effectName}\") returned null."); return(null); } SetTurnIndicatorColor(activeTurnIndicator, color, creatureAsset.CreatureScale); Log.Debug($"activeTurnIndicator.transform.SetParent(baseGameObject.transform);"); activeTurnIndicator.transform.SetParent(baseGameObject.transform); activeTurnIndicator.transform.position = creatureAsset.transform.position; return(creatureAsset); }
private static GameObject AddTarget(Vector3 targetPosition, Transform parent, float scale = 1, WhatSide whatSide = TaleSpireCore.WhatSide.Enemy) { GameObject targetDisk = new GameObject(STR_TargetDisk); if (targetDisk == null) { return(null); } GameObject targetDiskPrefab; if (whatSide == TaleSpireCore.WhatSide.Friendly) { targetDiskPrefab = Prefabs.Clone("TargetFriend"); } else if (whatSide == TaleSpireCore.WhatSide.Neutral) { targetDiskPrefab = Prefabs.Clone("TargetNeutral"); } else { targetDiskPrefab = Prefabs.Clone("TargetEnemy"); } if (targetDiskPrefab == null) { return(null); } targetDiskPrefab.name = STR_TargetDiskPrefab; GameObject targetRangeIndicator = targetDiskPrefab.FindChild(STR_TargetRangeIndicator); if (targetRangeIndicator == null) { Log.Error($"targetRangeIndicator NOT found!!!"); } else { Log.Warning($"targetRangeIndicator FOUND!!!"); targetRangeIndicator.SetActive(false); } targetDisk.name = STR_TargetDisk; const float percentAdjust = 0.6f; Property.Modify(targetDiskPrefab, "<TargetScale>.Scale", scale * percentAdjust); targetDisk.transform.position = targetPosition; if (parent != null) { targetDisk.transform.SetParent(parent); } targetDiskPrefab.transform.SetParent(targetDisk.transform); targetRangeIndicator = targetDiskPrefab.FindChild(STR_TargetRangeIndicator); if (targetRangeIndicator != null) { targetRangeIndicator = targetDisk.FindChild(STR_TargetRangeIndicator); if (targetRangeIndicator != null) { Log.Warning($"targetRangeIndicator was found! What IS GOING ON???"); } else { Log.Error($"targetRangeIndicator was NOT found. Why not?"); } } float yOffset = 0; if (scale == 0.5) { yOffset = -0.89f; } else if (scale == 1) { yOffset = -0.86f; } else if (scale == 2) { yOffset = -0.765f; } else if (scale == 3) { yOffset = -0.674f; } else if (scale == 4) { yOffset = -0.5725f; } targetDiskPrefab.transform.localPosition = new Vector3(0, 0.9f + yOffset, 0); targetDisks.Add(targetDisk); return(targetDisk); }