예제 #1
0
파일: UiManager.cs 프로젝트: aigoia/goetita
        void MakeHpBar(Enemy enemy, Color color)
        {
            if (Camera.main == null)
            {
                return;
            }

            var newClone = Instantiate
                           (
                barObject,
                Camera.main.WorldToScreenPoint(enemy.transform.position + posCorrection),
                Quaternion.identity, canvas.Find("Hp")
                           );

            var newBar = new BarNode {
                BaseTransform = enemy.transform, BarObject = newClone
            };

            barList.Add(newBar);
            var hpBar = newClone.GetComponent <CharacterBar>();

            hpBar.healthBar.color = color;
            enemy.characterBar    = hpBar;
            hpBar.enemy           = enemy;
        }
예제 #2
0
파일: UiManager.cs 프로젝트: aigoia/goetita
        void MakeHpBar(Player player, Color color)
        {
            if (Camera.main != null)
            {
                var newClone = Instantiate
                               (
                    barObject,
                    Camera.main.WorldToScreenPoint(player.transform.position + posCorrection),
                    Quaternion.identity, canvas.Find("Hp")
                               );

                var newBar = new BarNode {
                    BaseTransform = player.transform, BarObject = newClone
                };
                barList.Add(newBar);
                var hpBar = newClone.GetComponent <CharacterBar>();
                hpBar.healthBar.color = color;
                player.characterBar   = hpBar;
                hpBar.player          = player;
            }
        }