Example #1
0
            public static void ClearAttached(string spellId, string creatureId)
            {
                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(creatureId);

                if (creatureBoardAsset == null)
                {
                    Log.Error($"CreatureBoardAsset matching id {creatureId} not found!");
                    return;
                }

                GameObject creatureBase       = creatureBoardAsset.GetBase();
                string     attachedEffectName = GetAttachedEffectName(spellId);

                GameObject childEffect = creatureBase.FindChild(attachedEffectName);

                if (childEffect == null)
                {
                    Log.Error($"Child effect {attachedEffectName} not found.");
                    return;
                }

                while (childEffect != null)
                {
                    childEffect.transform.SetParent(null);
                    Instances.AddTemporal(childEffect, 2, 2);
                    childEffect = creatureBase.FindChild(attachedEffectName);
                }
            }
Example #2
0
            public static bool IsPersistentEffect(string creatureId)
            {
                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(creatureId);

                if (creatureBoardAsset != null)
                {
                    return(creatureBoardAsset.IsPersistentEffect());
                }
                return(false);
            }
Example #3
0
            /// <summary>
            /// Drops a target on the base of the specified creature.
            /// </summary>
            /// <param name="creatureId"></param>
            public static void Drop(string creatureId)
            {
                Log.Debug($"Target.Drop {creatureId}!");
                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(creatureId);

                if (creatureBoardAsset != null)
                {
                    Log.Debug($"creature found!");
                    AddTargetTo(creatureBoardAsset);
                }
            }
            public static CreatureBoardAsset LookAt(string id)
            {
                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(id);

                if (creatureBoardAsset != null)
                {
                    CreatureGuid creatureGuid = new CreatureGuid(creatureBoardAsset.Creature.CreatureId.Value);
                    CameraController.LookAtCreature(creatureGuid);
                }

                return(creatureBoardAsset);
            }
Example #5
0
            private static void PlayEffect(string effectName, string spellId, string creatureId, float lifeTime, float enlargeTimeSeconds, float secondsDelayStart, float shrinkTime, SpellLocation location, float rotationDegrees, bool isMoveable)
            {
                if (secondsDelayStart > 0)
                {
                    Log.Debug($"QueueEffect \"{effectName}\" for {secondsDelayStart} seconds...");
                    QueueEffect(new WaitingToCast(location, secondsDelayStart, effectName, spellId, creatureId, enlargeTimeSeconds, lifeTime, null, shrinkTime, rotationDegrees, isMoveable));
                    return;
                }

                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(creatureId);

                if (creatureBoardAsset == null)
                {
                    Log.Error($"CreatureBoardAsset matching id {creatureId} not found!");
                    return;
                }

                GameObject spell = GetSpell(effectName, spellId, lifeTime, enlargeTimeSeconds, shrinkTime, rotationDegrees, isMoveable);

                if (spell == null)
                {
                    Log.Error($"Spell name \"{effectName}\" not found!");
                    return;
                }

                GameObject creatureBase = creatureBoardAsset.GetBase();

                if (location == SpellLocation.CreatureCastSpell)
                {
                    Log.Vector("creatureBoardAsset.HookSpellCast.position", creatureBoardAsset.HookSpellCast.position);
                    spell.transform.position = creatureBoardAsset.HookSpellCast.position;
                }
                else                  // Default to base position...
                {
                    spell.transform.position = creatureBase.transform.position;
                }

                float creatureRotationDegrees = creatureBoardAsset.GetRotationDegrees();

                spell.transform.Rotate(Vector3.up, creatureRotationDegrees);
                //spell.transform.localEulerAngles = new Vector3(spell.transform.localEulerAngles.x, rotationDegrees, spell.transform.localEulerAngles.z);
                //Log.Vector("spell.transform.localEulerAngles", spell.transform.localEulerAngles);
                //spell.transform.Rotate(creatureBoardAsset.GetRotation());
                //Log.Vector("spell.transform.localEulerAngles2", spell.transform.localEulerAngles);

                if (isMoveable)
                {
                    Log.Warning($"EffectParameters.ApplyAfterPositioning(spell) on moveable effect {effectName}");
                }
                EffectParameters.ApplyAfterPositioning(spell, isMoveable);
            }
Example #6
0
            static void StorePersistentData(CreatureGuid iD, IOldPersistentEffect persistentEffect)
            {
                Log.Indent();
                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(iD.ToString());

                if (creatureBoardAsset != null)
                {
                    SavePersistentEffect(creatureBoardAsset, persistentEffect);
                }
                else
                {
                    Log.Error($"StorePersistentData -- creatureBoardAsset is null!");
                }

                Log.Unindent();
            }
            public static void RestoreCamera(bool doLook = false)
            {
                if (saveParent != null)
                {
                    Vector3 position = saveCameraTransform.position;

                    saveCameraTransform.SetParent(saveParent);

                    //if (saveCameraTransform.localEulerAngles == saveEulerAngles)
                    //	Log.Warning($"saveCamera.gameObject.transform.eulerAngles == saveEulerAngles");

                    saveCameraTransform.position = position;

                    if (targetWorldIdForRestoreCamera != null)
                    {
                        CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(targetWorldIdForRestoreCamera);
                        if (creatureBoardAsset != null)
                        {
                            GameObject baseGO = creatureBoardAsset.GetBase();
                            if (baseGO != null && doLook)
                            {
                                CameraController.LookAtTarget(baseGO.transform.position);
                            }
                        }
                    }

                    saveCameraTransform.localEulerAngles = saveEulerAngles;

                    saveParent          = null;
                    saveCameraTransform = null;
                    UnityEngine.Object.Destroy(spinner);
                    spinner = null;
                }
                else
                {
                    GameObject cameraRoot = GetRoot();
                    if (cameraRoot != null)
                    {
                        GameObject mainCamera = cameraRoot.FindChild("MainCamera");
                        if (mainCamera != null)
                        {
                            mainCamera.transform.localEulerAngles = Vector3.zero;
                        }
                    }
                }
            }
Example #8
0
            public static void AttachEffect(string effectName, string spellId, string creatureId, float secondsDelayStart, float enlargeTime, float lifeTime, float shrinkTime, float rotation)
            {
                if (secondsDelayStart > 0)
                {
                    QueueEffect(new WaitingToCast(SpellLocation.Attached, secondsDelayStart, effectName, spellId, creatureId, enlargeTime, lifeTime, null, shrinkTime, rotation));
                    return;
                }

                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(creatureId);

                if (creatureBoardAsset == null)
                {
                    Log.Error($"CreatureBoardAsset matching id {creatureId} not found!");
                    return;
                }

                AttachEffect(creatureBoardAsset, effectName, spellId, enlargeTime, lifeTime, shrinkTime);
            }
Example #9
0
            public static bool IsHidden(string creatureId)
            {
                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(creatureId);

                if (creatureBoardAsset == null)
                {
                    Log.Error($"IsHidden -- creatureBoardAsset == null");
                    return(false);
                }

                IOldPersistentEffect persistentEffect = creatureBoardAsset.GetPersistentEffect();

                if (persistentEffect == null)
                {
                    Log.Error($"IsHidden -- persistentEffect == null");
                    return(false);
                }

                return(persistentEffect.Hidden);
            }
Example #10
0
            public static bool IsRotationLocked(string creatureId)
            {
                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(creatureId);

                if (creatureBoardAsset == null)
                {
                    Log.Error($"IsRotationLocked -- creatureBoardAsset == null");
                    return(false);
                }

                IOldPersistentEffect persistentEffect = creatureBoardAsset.GetPersistentEffect();

                if (persistentEffect == null)
                {
                    Log.Error($"IsRotationLocked -- persistentEffect == null");
                    return(false);
                }

                //Log.Debug($"persistentEffect.RotationLocked = {persistentEffect.RotationIsLocked}");

                return(persistentEffect.RotationIsLocked);
            }
            public static CreatureBoardAsset SpinAround(string id)
            {
                if (saveCameraTransform != null)
                {
                    RestoreCamera();
                }

                CreatureBoardAsset targetCreatureBoardAsset = Minis.GetCreatureBoardAsset(id);

                if (targetCreatureBoardAsset == null)
                {
                    return(null);
                }

                CreatureGuid targetCreatureGuid = new CreatureGuid(targetCreatureBoardAsset.Creature.CreatureId.Value);

                targetWorldIdForRestoreCamera = targetCreatureBoardAsset.Creature.CreatureId.Value.ToString();
                CameraController.LookAtCreature(targetCreatureGuid);
                Vector3 targetPosition = targetCreatureBoardAsset.transform.position;

                StartSpinningCamera(targetPosition);

                return(targetCreatureBoardAsset);
            }
Example #12
0
            public static CreatureBoardAsset Set(string creatureId, bool targeted)
            {
                if (string.IsNullOrWhiteSpace(creatureId))
                {
                    return(null);
                }
                Log.Debug($"Target.Set {creatureId}!");
                CreatureBoardAsset creatureBoardAsset = Minis.GetCreatureBoardAsset(creatureId);

                if (creatureBoardAsset != null)
                {
                    if (IsTargeted(creatureBoardAsset) == targeted)
                    {
                        if (targeted)
                        {
                            Log.Warning($"creature {creatureId} is already targeted.");
                        }
                        else
                        {
                            Log.Warning($"creature {creatureId} is already NOT targeted.");
                        }

                        return(creatureBoardAsset);
                    }

                    if (targeted)
                    {
                        AddTargetTo(creatureBoardAsset);
                    }
                    else
                    {
                        RemoveTargetFrom(creatureBoardAsset);
                    }
                }
                return(creatureBoardAsset);
            }