Beispiel #1
0
    private void SetDisplay(Wave wave)
    {
        ClearEnemyDisplay();
        ToggleDisplays(true);
        title.text       = string.Format("Wave {0} of {1}", currentWave + 1, waves.Count);
        enemyAmount.text = $"Enemies in Wave: {wave.enemies.Count}";
        float totalRewardInWave = 0;
        Dictionary <EnemyType, int> amountOfEnemiesPerType = new Dictionary <EnemyType, int>();

        foreach (Enemy enemy in wave.enemies)
        {
            totalRewardInWave += enemy.Reward;
            if (amountOfEnemiesPerType.ContainsKey(enemy.enemyType))
            {
                amountOfEnemiesPerType[enemy.enemyType]++;
            }
            else
            {
                amountOfEnemiesPerType.Add(enemy.enemyType, 1);
            }
        }
        totalReward.text = $"Total Reward: {totalRewardInWave}";
        foreach (KeyValuePair <EnemyType, int> enemyType in amountOfEnemiesPerType)
        {
            GameObject enemyDisplay = Instantiate(object3DPrefab, enemyDisplayRect.content);
            UI.ThreeDimensional.UIObject3D object3D = enemyDisplay.GetComponent <UI.ThreeDimensional.UIObject3D>();
            object3D.ObjectPrefab         = enemyCollection[enemyType.Key];
            object3D.imageComponent.color = Color.white;
            enemyDisplay.GetComponentInChildren <TextMeshProUGUI>().text = $"{enemyType.Key} x {enemyType.Value}";
        }
    }
        void Awake()
        {
            UIObject3D      = this.GetComponent <UIObject3D>();
            initialRotation = UIObject3DUtilities.NormalizeRotation(UIObject3D.TargetRotation);

            SetupEvents();
        }
        internal static Vector3 GetTargetContainerPosition(UIObject3D uiObject3d)
        {
            if (targetContainers.ContainsKey(uiObject3d))
            {
                return(targetContainers[uiObject3d]);
            }

            return(GetNextFreeTargetContainerPosition());
        }
        internal static void RegisterTargetContainerPosition(UIObject3D uiObject3D, Vector3 position)
        {
            if (targetContainers.ContainsKey(uiObject3D))
            {
                return;
            }

            targetContainers.Add(uiObject3D, position);
        }
Beispiel #5
0
        private void OnEnable()
        {
            if (UIObject3D == null)
            {
                UIObject3D = GetComponent <UIObject3D>();
            }

            UIObject3D.OnUpdateTarget.AddListener(UpdateLightEvent);

            lightObject.enabled = true;
            UpdateLight(true);
        }
        void Awake()
        {
            UIObject3D = this.GetComponent <UIObject3D>();

            SetupEvents();
        }
 internal static void UnRegisterTargetContainer(UIObject3D uiObject3D)
 {
     targetContainers.Remove(uiObject3D);
 }