Exemplo n.º 1
0
        // Use this for initialization
        public NpcDefine GetNpcDefine(int npcID)
        {
            NpcDefine npc = null;

            DataManager.Instance.NPCs.TryGetValue(npcID, out npc);
            return(npc);
        }
Exemplo n.º 2
0
 private void OnStopInteractive(NpcDefine define)
 {
     Debug.Log("OnStopInteractive");
     if (define.ID == mNpcDefine.ID)
     {
         StartCoroutine(StopInteractive());
     }
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
        private bool DoTaskInteractive(NpcDefine npc)
        {
            var status = QuestManager.Instance.GetQuestStatusByNpc(npc.ID);

            if (status == NpcQuestStatus.None)
            {
                return(false);
            }
            return(QuestManager.Instance.OpenNpcQuest(npc.ID));
        }
Exemplo n.º 6
0
    private bool OnOpenShop(NpcDefine define)
    {
        onInteractive = define;

        UIManager.Instance.ShowPanel <ShopPanel>(typeof(ShopPanel), (panel) =>
        {
            panel.Init(define.Param);
        });

        return(true);
    }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 private bool DoFunctionInteractive(NpcDefine npc)
 {
     if (npc.Type != NpcType.Functional)
     {
         return(false);
     }
     if (!EventMap.ContainsKey(npc.Function))
     {
         return(false);
     }
     return(EventMap[npc.Function](npc));
 }
Exemplo n.º 9
0
 public bool Interactive(NpcDefine npc)
 {
     if (DoTaskInteractive(npc))
     {
         return(true);
     }
     if (npc.Type == NpcType.Functional)
     {
         return(DoFunctionInteractive(npc));
     }
     return(false);
 }
Exemplo n.º 10
0
    public bool EventTrigger(int npcID)
    {
        NpcDefine npc = DataManager.Instance.Npcs[npcID];

        if (npc != null)
        {
            return(EventTrigger(npc));
        }
        else
        {
            return(false);
        }
    }
Exemplo n.º 11
0
 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);
     }
 }
Exemplo n.º 12
0
    public bool EventTrigger(NpcDefine npc)
    {
        switch (npc.Type)
        {
        case NpcType.Task:
            return(TaskInteractive(npc));

        case NpcType.Functional:
            return(FunctionalInteractive(npc));

        default:
            return(false);
        }
    }
Exemplo n.º 13
0
    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());
    }
Exemplo n.º 14
0
 private bool TaskInteractive(NpcDefine npc)
 {
     Debug.Log("interact with a task npc");
     return(true);
 }
Exemplo n.º 15
0
 private bool OnOpenShop(NpcDefine npc)
 {
     this.ShowShop(npc.Parm);
     return(true);
 }
Exemplo n.º 16
0
 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);
 }
Exemplo n.º 17
0
 public void StopInteractive()
 {
     Debug.Log("ShopManager() => StopInteractive()");
     NpcManager.Instance.StopInteractive(onInteractive);
     onInteractive = null;
 }
Exemplo n.º 18
0
 private bool OnOpenStory(NpcDefine npc)
 {
     this.ShowStoyUI(npc.Param);
     return(true);
 }
Exemplo n.º 19
0
 public void StopInteractive(NpcDefine define)
 {
     Debug.Log("NpcManager => StopInteractive");
     EventCenter.Instance.EventTrigger <NpcDefine>("StopInteractive", define);
 }