public void ComputeRotationToTarget(GameObjectViewComponent targetView, ref float rotation)
        {
            Vector3 position  = this.MainTransform.position;
            Vector3 position2 = targetView.MainTransform.position;
            float   y         = position2.z - position.z;
            float   x         = position2.x - position.x;

            rotation = Mathf.Atan2(y, x);
        }
예제 #2
0
        public GeneratorViewComponent(Entity entity)
        {
            this.viewComp      = entity.Get <GameObjectViewComponent>();
            this.collectButton = new CollectButton(entity);
            UXController uXController = Service.UXController;

            this.textLabel         = uXController.MiscElementsManager.CreateCollectionLabel("GeneratorCollectLabel", uXController.WorldAnchor);
            this.textLabel.Visible = false;
            this.textTimerId       = 0u;
        }
예제 #3
0
        public void SetupElements(GameObjectViewComponent view, bool primary, bool secondary)
        {
            if (this.IsInitialized)
            {
                return;
            }
            if (this.HealthAmount >= this.MaxHealthAmount && this.SecondaryHealthAmount >= this.SecondaryMaxHealthAmount)
            {
                this.TeardownElements();
                return;
            }
            this.IsInitialized = true;
            if (primary && TooltipHelper.WouldOverlapAnotherTooltip(view))
            {
                return;
            }
            this.secondaryOnly = (secondary && !primary);
            UXController uXController = Service.Get <UXController>();
            string       text         = "HealthSlider" + view.MainGameObject.GetInstanceID().ToString();

            if (primary)
            {
                this.slider = uXController.MiscElementsManager.CreateHealthSlider(text, uXController.WorldUIParent, false);
                if (this.slider != null)
                {
                    this.slider.Value = 1f;
                    this.tooltipHelper.SetupElements(view, this.slider, 0f, true, true);
                }
            }
            if (secondary)
            {
                this.secondarySlider = uXController.MiscElementsManager.CreateHealthSlider("s_" + text, uXController.WorldUIParent, true);
                if (this.secondarySlider != null)
                {
                    this.secondarySlider.Value = 1f;
                    this.secondaryTooltipHelper.SetupElements(view, this.secondarySlider, 1f, true, false);
                }
            }
        }