コード例 #1
0
ファイル: GameManager.cs プロジェクト: AmbroseC/Rangers
        // Sets up singleton instance. Will remain if one does not already exist in scene
        void Awake()
        {
            if (instance == null)
            {
                DontDestroyOnLoad(gameObject);
                instance = this;
            }
            else if (instance != this)
            {
                Destroy(gameObject);
            }

            controllers = new List<Controller>();
            customColor = new CustomColor();
        }
コード例 #2
0
ファイル: CustomColor.cs プロジェクト: szhangGT/Rangers
        /// <summary>
        /// Gets a color from a property name in CustomColor
        /// </summary>
        /// <param name="uObject">The CustomColor object to pull the property from</param>
        /// <param name="propertyName">The name of the property/color to return</param>
        /// <returns></returns>
        public static Color ColorFromProperty(CustomColor uObject, string propertyName)
        {
            PropertyInfo property = typeof(CustomColor).GetProperty(propertyName, typeof(Color));
            Color        color    = black;

            if (property != null)
            {
                color = (Color)(property.GetValue(uObject, null));
            }
            else
            {
                Debug.LogError("There is no property named " + propertyName + " in CustomColor. Returning Black by default.");
                color = black;
            }
            return(color);
        }
コード例 #3
0
ファイル: OneColor.cs プロジェクト: K3nob1/Achromic_Warrior
 void Awake()
 {
     if (_ui)
     {
         this.GetComponent <Image>().color = CustomColor.GetColor(_color);
     }
     else
     {
         if (onlyChildren)
         {
             Renderer[] _r = this.GetComponentsInChildren <Renderer>();
             for (int i = 0; i < _r.Length; i++)
             {
                 _r[i].material.color = CustomColor.GetColor(_color);
             }
         }
         else
         {
             this.GetComponent <Renderer>().material.color = CustomColor.GetColor(_color);
         }
     }
 }
コード例 #4
0
ファイル: CustomColor.cs プロジェクト: AmbroseC/Rangers
 /// <summary>
 /// Gets a color from a property name in CustomColor
 /// </summary>
 /// <param name="uObject">The CustomColor object to pull the property from</param>
 /// <param name="propertyName">The name of the property/color to return</param>
 /// <returns></returns>
 public static Color ColorFromProperty(CustomColor uObject, string propertyName)
 {
     PropertyInfo property = typeof(CustomColor).GetProperty(propertyName, typeof(Color));
     Color color = black;
     if (property != null)
     {
         color = (Color)(property.GetValue(uObject, null));
     }
     else
     {
         Debug.LogError("There is no property named " + propertyName + " in CustomColor. Returning Black by default.");
         color =  black;
     }
     return color;
 }