Ejemplo n.º 1
0
        internal void Setup(byte teamID, MinimapTrackable obj, bool isCharacterProfile)
        {
            _trackedObject = obj;

            //  Set the correct colours
            var imageComp = GetComponent<Image>();
            var trans = GetComponent<RectTransform>();

            if (teamID > 0)
                imageComp.color = teamID == 1 ? Color.blue : Color.red;

            /*  Character profile trackables should be drawn differently from other
            //  trackables.
            //  Characters should be drawn ontop
            */

            if (isCharacterProfile)
            {
                trans.sizeDelta = new Vector2(cPlayerIconSize, cPlayerIconSize);
                _characterProfileImage.sprite = obj.Sprite;
            }
            else
            {
                //  Delete the mask to also get rid of characterProfile image
                Destroy(transform.GetChild(0).gameObject);

                if (obj.Sprite)
                {
                    imageComp.sprite = obj.Sprite;
                    trans.sizeDelta = new Vector2(cWorldObjectIconSize, cWorldObjectIconSize);
                }
            }
        }
Ejemplo n.º 2
0
        public void AddTrackable(MinimapTrackable trackable)
        {
            if (!trackable)
                throw new ArgumentNullException("MINIMAPTRACKER::ADDTRACKER::TRACKABLE_IS_NULL");

            var obj = Instantiate(trackedObjectPrefab.gameObject);
            obj.transform.SetParent(transform);

            var newTracked = obj.GetComponent<MinimapTrackedObject>();
            newTracked.Setup(0, trackable, trackable is CharacterMinimapTrackable);

            _tracked.Add(newTracked);
        }