// Use this for initialization public NpcDefine GetNpcDefine(int npcID) { NpcDefine npc = null; DataManager.Instance.NPCs.TryGetValue(npcID, out npc); return(npc); }
private void OnStopInteractive(NpcDefine define) { Debug.Log("OnStopInteractive"); if (define.ID == mNpcDefine.ID) { StartCoroutine(StopInteractive()); } }
private bool OnNpcInvokeShop(NpcDefine npc) { Debug.LogFormat("TestManager.OnNpcInvokeShop:NPC:[{0}:{1}] Type:{2} Func:{3}", npc.ID, npc.Name, npc.Type, npc.Function); UITest test = UIManager.Instance.Show <UITest>(); test.SetTitle(npc.Name); return(true); }
void Start() { renderer = this.gameObject.GetComponentInChildren <SkinnedMeshRenderer>(); anim = this.gameObject.GetComponent <Animator>(); originColor = renderer.sharedMaterial.color; npc = NPCManager.Instance.GetNpcDefine(this.npcId); this.StartCoroutine(Actions()); RefreshNpcStatus(); QuestManager.Instance.onQuestStatusChanged += OnQuestStatusChanged; }
private bool DoTaskInteractive(NpcDefine npc) { var status = QuestManager.Instance.GetQuestStatusByNpc(npc.ID); if (status == NpcQuestStatus.None) { return(false); } return(QuestManager.Instance.OpenNpcQuest(npc.ID)); }
private bool OnOpenShop(NpcDefine define) { onInteractive = define; UIManager.Instance.ShowPanel <ShopPanel>(typeof(ShopPanel), (panel) => { panel.Init(define.Param); }); return(true); }
void Start() { render = this.gameObject.GetComponentInChildren <SkinnedMeshRenderer>(); anim = this.gameObject.GetComponent <Animator>(); npc = NpcManager.Instance.GetNpcDefine(npcID); NpcManager.Instance.UpdateNpcPostion(this.npcID, this.transform.position); orignColor = render.sharedMaterial.color; this.StartCoroutine(Actions()); RefreshNpcStatus(); QuestManager.Instance.onQuestStatusChanged += onQuestStatusChanged; }
private bool DoFunctionInteractive(NpcDefine npc) { if (npc.Type != NpcType.Functional) { return(false); } if (!EventMap.ContainsKey(npc.Function)) { return(false); } return(EventMap[npc.Function](npc)); }
public bool Interactive(NpcDefine npc) { if (DoTaskInteractive(npc)) { return(true); } if (npc.Type == NpcType.Functional) { return(DoFunctionInteractive(npc)); } return(false); }
public bool EventTrigger(int npcID) { NpcDefine npc = DataManager.Instance.Npcs[npcID]; if (npc != null) { return(EventTrigger(npc)); } else { return(false); } }
private bool FunctionalInteractive(NpcDefine npc) { Debug.Log("interact with a functional npc"); if (NpcEvents.ContainsKey(npc.Function)) { NpcEvents[npc.Function].Invoke(npc); return(true); } else { return(false); } }
public bool EventTrigger(NpcDefine npc) { switch (npc.Type) { case NpcType.Task: return(TaskInteractive(npc)); case NpcType.Functional: return(FunctionalInteractive(npc)); default: return(false); } }
public void Start() { //get necessary components mAnimator = GetComponent <Animator>(); mTrigger = GetComponent <BoxCollider>(); //get npcdefine mNpcDefine = DataManager.Instance.Npcs[NpcID]; //get current facing direction mForward = new Vector3(this.transform.forward.x, this.transform.forward.y, this.transform.forward.z); //let the npc do some random actions StartCoroutine(RandomAction()); }
private bool TaskInteractive(NpcDefine npc) { Debug.Log("interact with a task npc"); return(true); }
private bool OnOpenShop(NpcDefine npc) { this.ShowShop(npc.Parm); return(true); }
private bool OnNpcInvokeInsrance(NpcDefine npc) { Debug.LogFormat("TestManager.OnNpcInvokeInsrance:NPC:[{0}:{1}] Type:{2} Func:{3}", npc.ID, npc.Name, npc.Type, npc.Function); MessageBox.Show("点击了NPC:" + npc.Name, "NPC对话"); return(true); }
public void StopInteractive() { Debug.Log("ShopManager() => StopInteractive()"); NpcManager.Instance.StopInteractive(onInteractive); onInteractive = null; }
private bool OnOpenStory(NpcDefine npc) { this.ShowStoyUI(npc.Param); return(true); }
public void StopInteractive(NpcDefine define) { Debug.Log("NpcManager => StopInteractive"); EventCenter.Instance.EventTrigger <NpcDefine>("StopInteractive", define); }