コード例 #1
0
ファイル: Npc.cs プロジェクト: xiejiashu/Destiny
        public void Converse(Character talker)
        {
            if (this.Shop != null)
            {
                this.Shop.Show(talker);
            }
            else if (this.StorageCost > 0)
            {
                talker.Storage.Show(this);
            }
            else
            {
                var script = new NpcScript(this, talker);

                this.Scripts[talker] = script;

                try
                {
                    script.Execute();
                }
                catch (Exception ex)
                {
                    //Log.Error("Error in NPC conversation: {0}", ex);
                }
            }
        }
コード例 #2
0
    public void StartDialogue(int npcId)
    {
        var npcType = m_DialogueReader.GetNpcType(npcId);

        if (npcType == null)
        {
            Debug.Log("NO NPC FOUND");
            return;
        }

        PlayerManager.Instance.DisableInput();

        m_CurrentScript = ScriptActivator.CreateScriptInstance <NpcScript>(npcType, npcId);

        Debug.Log("Current State: " + m_CurrentScript.State);
        m_CurrentScript.Execute();
    }
コード例 #3
0
 public void GoToNextState(int state)
 {
     Debug.Log("Next State: " + state);
     m_CurrentScript.State = state;
     m_CurrentScript.Execute();
 }