Пример #1
0
        public void InitializeInstance(MonoBehaviour script)
        {
            MiniGrouperScript = script as MiniGrouper;
            if (MiniGrouperScript != null)
            {
                MiniGrouperScript.StateChanged -= MiniGrouperScript_StateChanged;
                MiniGrouperScript.StateChanged += MiniGrouperScript_StateChanged;
            }
            else
            {
                Talespire.Log.Error($"InitializeInstance - MiniGrouperScript is null!");
            }

            RefreshMemberList();
            RefreshTrackHue();
            changingInternally = true;
            try
            {
                UpdateGroupControls();
                UpdateFormationControls();
                UpdateLookControls();
                UpdateFormationStyleControls();
                if (MiniGrouperScript != null)
                {
                    trkSpacing.Value     = MiniGrouperScript.Data.Spacing;
                    lblSpacingValue.Text = $"{MiniGrouperScript.Data.Spacing}ft";

                    trkArcAngle.Value     = MiniGrouperScript.Data.ArcAngle;
                    lblArcAngleValue.Text = $"{MiniGrouperScript.Data.ArcAngle}°";

                    trkColumnsRadius.Maximum = 1000;
                    trkColumnsRadius.Value   = MiniGrouperScript.Data.ColumnRadius;

                    lastColumnCount = MiniGrouperScript.Data.ColumnRadius;
                    lastRadius      = MiniGrouperScript.Data.ColumnRadius;

                    switch (MiniGrouperScript.Data.FormationStyle)
                    {
                    case FormationStyle.FreeForm:
                        EditingNeitherColumnsNorCircular();
                        break;

                    case FormationStyle.Gaggle:
                    case FormationStyle.Rectangle:
                        EditingColumns();
                        break;

                    case FormationStyle.Circle:
                        EditingCircular();
                        break;
                    }
                }
            }
            finally
            {
                changingInternally = false;
            }
            MiniGrouperScript?.RefreshIndicators();
        }
Пример #2
0
        void InitializeNewlySpawnedCreatures()
        {
            Talespire.Log.Indent();
            UnityMainThreadDispatcher.ExecuteOnMainThread(() =>
            {
                RefreshMemberList();
                MiniGrouperScript.RefreshIndicators();
                UpdateFormation();
            });

            MiniGrouperScript.DataChanged();
            Talespire.Log.Unindent();
        }