Exemplo n.º 1
0
        public static GameObject MountModel(string _id, Transform _parent, MaterialPair _materialPair,
                                            ModelType _type = ModelType.AnturaForniture)
        {
            CleanTranformChildren(_parent);
            GameObject returnObject = MountModel(_id, _parent, _type);

            SwitchMaterial(returnObject, _materialPair);
            return(returnObject);
        }
Exemplo n.º 2
0
        public MaterialPair GetMaterialPair()
        {
            if (!(RewardBase is RewardProp))
            {
                throw new Exception("Trying to get a material pair for a non-prop pack");
            }

            RewardProp  prop  = RewardBase as RewardProp;
            RewardColor color = RewardColor;

            if (color == null || prop == null)
            {
                return(new MaterialPair());
            }
            MaterialPair mp = new MaterialPair(color.Color1Name, prop.Material1, color.Color2Name, prop.Material2);

            return(mp);
        }
Exemplo n.º 3
0
 public static MaterialPair SwitchMaterial(GameObject _gameObject, MaterialPair _materialPair)
 {
     if (_materialPair.Material1 == null || _materialPair.Material2 == null)
     {
         return(_materialPair);
     }
     foreach (var color in _gameObject.GetComponentsInChildren <MeshRenderer>())
     {
         if (color.name == "color_1")
         {
             color.materials = new Material[] { _materialPair.Material1 };
         }
         else if (color.name == "color_2")
         {
             color.materials = new Material[] { _materialPair.Material2 };
         }
     }
     return(_materialPair);
 }