Beispiel #1
0
        protected virtual void OnEnable()
        {
            EmissionsManager.AddEmissions(Settings.Emissions);
            string renderer = UnitRenderer.GetRenderer(Settings.Symbol);

            if (renderer != "")
            {
                unitRenderer = ObjectPool.Instantiate(renderer) as UnitRenderer;
                unitRenderer.transform.SetParent(MyTransform);
                unitRenderer.transform.localPosition = unitRenderer.Offset;
            }
        }
Beispiel #2
0
        public void SetTask(PerformerTask task)
        {
            RemoveTask();
            currentTask               = ObjectPool.Instantiate(renderers[task.GetType()]).GetComponent <UnitRenderer> ();
            currentTask.Parent        = MyTransform;
            currentTask.LocalPosition = Vector3.zero;

            Vector3 originalScale = currentTask.LocalScale;

            currentTask.LocalScale = new Vector3(
                originalScale.x * 0.3f,
                originalScale.y * 0.3f,
                originalScale.z * 0.3f);
        }
Beispiel #3
0
        protected virtual void OnDisable()
        {
            EmissionsManager.RemoveEmissions(Settings.Emissions);
            if (Selected)
            {
                SelectionManager.Unselect();
            }
            string renderer = UnitRenderer.GetRenderer(Settings.Symbol);

            if (renderer != "")
            {
                if (unitRenderer != null)
                {
                    ObjectPool.Destroy(unitRenderer);
                    unitRenderer = null;
                }
            }
        }