public void SetState(GameObjState state) { mystate = state; if (m != null) { lastColor = targetColor; if (state == GameObjState.black) { targetColor = new Color(0, 0, 0); } else { targetColor = new Color(1, 1, 1); } colorAction = colorMaxAction; } }
private void Start() { if (Swd6Application.instance) { Swd6Application instance = Swd6Application.instance; int mapID = instance.m_GameDataSystem.m_MapInfo.MapID; string text = base.gameObject.name; if (base.gameObject.transform.parent != null) { text = base.gameObject.transform.parent.name; } if (text.Contains("NPC_")) { text = text.Replace("NPC_", ""); this.RoleID = int.Parse(text); this.m_NpcData = GameDataDB.NpcDB.GetData(this.RoleID); if (this.m_NpcData == null) { Debug.Log("找不到NPC資料_" + this.RoleID); } if (!instance.m_GameObjSystem.CheckGameObjData(this.RoleID)) { int num = (int)this.m_RoleState.Get(); string.Format(string.Concat(new object[] { base.gameObject.name, "+", this.RoleID, "+", mapID, "+", num.ToString("X") }), new object[0]); this.LoadPrefabModel(); this.m_GameObjData = new S_GameObjData(this.RoleID, mapID, this.GetPos(), this.GetDir(), this.m_NpcData.Motion, this.m_RoleState, base.gameObject); instance.m_GameObjSystem.AddGameObjData(this.m_GameObjData); } else { this.m_GameObjData = instance.m_GameObjSystem.GetObjData(this.RoleID); if (this.m_GameObjData != null) { this.LoadPrefabModel(); this.m_GameObjData.GameObj = base.gameObject; int num2 = (int)this.m_GameObjData.State.Get(); string.Format(string.Concat(new object[] { base.gameObject.name, "+", this.m_GameObjData.MapId, "+", num2.ToString("X") }), new object[0]); this.m_RoleState = this.m_GameObjData.State; if (mapID != this.m_GameObjData.MapId) { UnityEngine.Object.Destroy(base.gameObject); return; } if (this.m_GameObjData.Pos == Vector3.zero) { this.m_GameObjData.Pos = this.GetPos(); } this.SetPos(this.m_GameObjData.Pos); if (this.m_GameObjData.Dir != 1000f) { this.Dir = this.m_GameObjData.Dir; } if (this.HideRole) { this.HideRole = true; } if (this.NoCollider) { this.NoCollider = true; } if (this.DisableRole && this.m_NpcData.emType != ENUM_NpcType.Egg) { if (this.Open) { ExploreMiniMapSystem.Instance.ChangeToOpenIcon(this.RoleID); } UnityEngine.Object.Destroy(base.gameObject); } } } } } if (this.m_NpcData != null) { this.m_RoleMotion = base.GetComponent <M_GameRoleMotion>(); if (this.m_RoleMotion != null) { this.m_RoleMotion.Init(this.RoleID, this.m_GameObjData.Motion); } if (this.m_NpcData.Talk != null) { base.gameObject.AddComponent(this.m_NpcData.Talk); } } ExploreMiniMapSystem.Instance.CreateNpcIcon(this.RoleID); this.initialize(); }