コード例 #1
0
ファイル: ShaderAssets.cs プロジェクト: SanLin-He/face-nn
 public static void RefeshMat(Material mat, BlendMode blendMode, KeywordFlags keyWord, bool enableLightMap, bool enableShadow)
 {
     if (mat != null)
     {
         mat.shaderKeywords = null;
         for (int i = 0; i < keyWordFlag.Length; ++i)
         {
             KeywordFlags flag = keyWordFlag[i];
             if (((uint)(keyWord & flag)) != 0)
             {
                 mat.EnableKeyword(keyWords[i]);
             }
         }
         if (enableLightMap)
         {
             mat.EnableKeyword("_CUSTOM_LIGHTMAP_ON");
         }
         if (enableShadow)
         {
             mat.EnableKeyword("_SHADOW_MAP");
         }
         SetupMaterialWithBlendMode(mat, blendMode);
     }
 }
コード例 #2
0
            public void Deserialize(GenericReader reader)
            {
                int version = reader.ReadInt();
                switch (version)
                {
                    case 1:
                        Flags = (KeywordFlags)reader.ReadInt();
                        goto case 0;
                    case 0:
                        m_Spawner = (XmlSpawner)reader.ReadItem();
                        Type = reader.ReadInt();
                        Serial = reader.ReadInt();
                        if (Type == 0)
                        {
                            // get any timer info
                            TimeSpan delay = reader.ReadTimeSpan();
                            m_Delay = reader.ReadTimeSpan();
                            m_Condition = reader.ReadString();
                            m_Goto = reader.ReadInt();

                            TimeSpan timeoutdelay = reader.ReadTimeSpan();
                            m_TimeoutEnd = DateTime.Now + timeoutdelay;
                            m_Timeout = reader.ReadTimeSpan();
                            m_TrigMob = reader.ReadMobile();

                            this.DoTimer(delay, m_Delay, m_Condition, m_Goto);
                        }
                        break;
                }
            }
コード例 #3
0
            public KeywordTag(string typename, XmlSpawner spawner, int type, TimeSpan delay, TimeSpan timeout, string condition, int gotogroup)
            {
                Type = type;
                m_Delay = delay;
                m_Timeout = timeout;
                m_TimeoutEnd = DateTime.Now + timeout;
                m_Spawner = spawner;
                m_Condition = condition;
                m_Goto = gotogroup;

                Typename = typename;
                // add the tag to the list
                if (spawner != null && !spawner.Deleted)
                {
                    m_TrigMob = spawner.TriggerMob;
                    if (spawner.m_KeywordTagList == null)
                    {
                        spawner.m_KeywordTagList = new ArrayList();
                    }
                    // calculate the serial index of the new tag by adding one to the last one if there is one, otherwise just reset to 0
                    if (spawner.m_KeywordTagList.Count > 0)
                        Serial = ((KeywordTag)(spawner.m_KeywordTagList[spawner.m_KeywordTagList.Count - 1])).Serial + 1;
                    else
                        Serial = 0;

                    spawner.m_KeywordTagList.Add(this);

                    switch (type)
                    {
                        case 0: // WAIT timer type
                            // start up the timer
                            DoTimer(delay, m_Delay, condition, gotogroup);
                            // and put spawning on hold until it is done
                            //spawner.OnHold = true;
                            Flags |= KeywordFlags.HoldSpawn;
                            Flags |= KeywordFlags.Serialize;

                            break;
                        case 1: // GUMP type

                            break;
                        case 2: // GOTO type
                            Flags |= KeywordFlags.HoldSequence;
                            Flags |= KeywordFlags.Serialize;

                            break;
                        default:
                            // dont do anything for other types
                            Flags |= KeywordFlags.Defrag;
                            break;
                    }
                }
            }
コード例 #4
0
 public static void CreateDummyMat(string name, Shader shader, BlendMode blendMode, KeywordFlags keyWord, bool enableLightMap, bool enableShadow)
 {
     if (shader != null)
     {
         Material mat = new Material(shader);
         RefeshMat(mat, blendMode, keyWord, enableLightMap, enableShadow);
         CommonAssets.CreateAsset <Material>(string.Format("{0}/{1}",
                                                           AssetsConfig.GlobalAssetsConfig.ResourcePath,
                                                           AssetsConfig.GlobalAssetsConfig.DummyMatFolder), name, ".mat", mat);
     }
 }