Exemple #1
0
        /// <summary>
        /// Runs before any Update is called
        /// </summary>
        void Start()
        {
            // Create our global instance
            if (TargetingReticle.Instance == null)
            {
                TargetingReticle.DefaultIsVisible = IsVisible;
                TargetingReticle.Instance         = this;
            }

            // Ensure we have a casting root
            if (RaycastRoot == null && Camera.main != null)
            {
                RaycastRoot = Camera.main.transform;
            }

            // Ensure the position is set
            if (_FillTexture != null)
            {
                FillTexture = _FillTexture;
            }
            if (_BGTexture != null)
            {
                BGTexture = _BGTexture;
            }

            // Initialize the material
            FillPercent = 1f;
            FillPercent = 0f;
        }
Exemple #2
0
 /// <summary>
 /// Called when the script object is loaded
 /// </summary>
 void OnEnable()
 {
     // Grab the serialized objects
     mTarget   = (TargetingReticle)target;
     mTargetSO = new SerializedObject(target);
 }