/// <summary>
    /// When Player destroys one Well, hide all others that are currently not visible,
    /// so Tiles remain in sync. The current Well will be handled by its respective Timeline sequence.
    /// </summary>
    public void OnFrozenWellDie(Script_FrozenWellCrackableStats iceStats)
    {
        Script_FrozenWell destroyedFrozenWell = iceStats.GetComponent <Script_FrozenWell>();

        Debug.Log($"Frozen Well destroyed: {destroyedFrozenWell}");

        if (destroyedFrozenWell == null)
        {
            return;
        }

        // If one of the frozen wells destroyed is 1 we are tracking, then destroy
        // all frozen wells.
        Script_FrozenWell matchingFrozenWell = frozenWells.FirstOrDefault(
            frozenWell => frozenWell == destroyedFrozenWell
            );

        Debug.Log($"Matching Frozen Well destroyed: {matchingFrozenWell}");

        if (matchingFrozenWell != null)
        {
            foreach (Script_FrozenWell frozenWell in frozenWells)
            {
                // Skip the current Well which will be handled by its Timeline.
                if (matchingFrozenWell == frozenWell)
                {
                    continue;
                }

                Debug.Log($"Setting frozenWell inactive: {frozenWell.gameObject.name}");
                frozenWell.gameObject.SetActive(false);
            }
        }
    }
Beispiel #2
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Script_FrozenWell t = (Script_FrozenWell)target;

        if (GUILayout.Button("Freeze"))
        {
            t.Freeze();
        }
    }