コード例 #1
0
ファイル: NpcSetup.cs プロジェクト: atom-chen/Dark-light
    // Use this for initialization
    void Start()
    {
        // Change this tag to Npc
        if (this.tag != "Npc")
        {
            this.tag = "Npc";
        }

        if (this.gameObject.layer != 13)
        {
            this.gameObject.layer = 13;
        }

        indexDialog = 0;

        playerControl = GameObject.FindGameObjectWithTag("Player").GetComponent <HeroController>();

        if (npcType == NpcType.QuestNpc)
        {
            questData = GameObject.Find("QuestData").GetComponent <Quest_Data>();
            //questWindow = GameObject.Find("GUI Manager/QuestWindow").GetComponent<QuestWindow>();
            player    = GameObject.FindGameObjectWithTag("Player");
            inventory = player.transform.Find("Inventory").GetComponent <GUI_Menu>();
        }
    }
コード例 #2
0
 void Start()
 {
     enableLoadData = PlayerPrefs.GetString("Enable Load");
     questData      = GameObject.Find("QuestData").GetComponent <Quest_Data>();
     if (enableLoadData == "True" && LoadGameButton.loadData)
     {
         Invoke("LoadData", 0.2f);
         enableLoadData = "False";
     }
 }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        enableWindow       = false;
        defaultScreenRes.x = 1920;                                  //declare max screen ratio
        defaultScreenRes.y = 1080;                                  //declare max screen ratio

        GameObject go = GameObject.FindGameObjectWithTag("Player"); //Find player

        controller = go.GetComponent <HeroController>();

        questData   = GameObject.Find("QuestData").GetComponent <Quest_Data>();
        itemData    = GameObject.Find("Item_Data").GetComponent <Item_Data>();
        monsterData = GameObject.Find("MonsterData").GetComponent <Monster_Data>();
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        //set spawn point
        destinationPosition = this.transform.position;

        //get anathor component
        animationManager = this.GetComponent <AnimationManagerEnemy>();
        enemyStatus      = this.GetComponent <EnemyStatus>();
        controller       = this.GetComponent <CharacterController>();
        questData        = GameObject.Find("QuestData").GetComponent <Quest_Data>();

        delayAttack = 100;     //Declare delay 100 sec
        flinchValue = 100;     //Declare flinch value (if zero it will flinch)
        fadeValue   = 1;       //Set fade value

        //Set first spawn point
        spawnPoint = transform.position;

        //set default value
        defaultReturnPhase = returnPhase;
        defaultHP          = enemyStatus.status.hp;
        defaultMP          = enemyStatus.status.mp;

        defaultColor = new Color[modelMesh.Count];
        SetDefualtColor();

        if (behavior == EnemyBehavior.MoveAround)
        {
            moveBehavior = MoveAroundBehavior.Waiting;
        }

        //warning when enemy isn't detect area
        if (nature == EnemyNature.Wild)
        {
            detectArea = GameObject.Find("DetectArea");

            if (detectArea == null)
            {
                Debug.LogWarning("Don't found DetectArea in Enemy -" + enemyStatus.name);
            }
        }
    }
コード例 #5
0
    public override void OnInspectorGUI()
    {
        Quest_Data questData = (Quest_Data)target;

        showQuest = EditorGUILayout.Foldout(showQuest, "Quest Setup");
        EditorGUI.indentLevel++;
        if (showQuest)
        {
            questData.sizeQuest = EditorGUILayout.IntField("Quest List", questData.sizeQuest);

            while (questData.sizeQuest != questData.questSetting.Count)
            {
                if (questData.sizeQuest > questData.questSetting.Count)
                {
                    questData.questSetting.Add(new Quest_Data.QuestSetting());
                    questData.showSizeQuest.Add(true);
                }
                else
                {
                    questData.questSetting.RemoveAt(questData.questSetting.Count - 1);
                    questData.showSizeQuest.RemoveAt(questData.showSizeQuest.Count - 1);
                }
            }


            for (int i = 0; i < questData.questSetting.Count; i++)
            {
                questData.showSizeQuest[i] = EditorGUILayout.Foldout(questData.showSizeQuest[i], "Quest " + (i + 1).ToString());

                if (questData.showSizeQuest[i])
                {
                    EditorGUILayout.LabelField("Quest ID", questData.questSetting[i].questID.ToString());
                    questData.questSetting[i].questID = 1000 + (i + 1);

                    questData.questSetting[i].questName = EditorGUILayout.TextField("Quest Name", questData.questSetting[i].questName);

                    EditorGUILayout.LabelField("Quest Detail", "");
                    EditorGUI.indentLevel++;
                    questData.questSetting[i].questDetail = EditorGUILayout.TextArea(questData.questSetting[i].questDetail);
                    EditorGUI.indentLevel--;

                    EditorGUILayout.Space();
                    questData.questSetting[i].questCondition = (Quest_Data.QuestCondition)EditorGUILayout.EnumPopup("Quest Condition", questData.questSetting[i].questCondition);

                    if (questData.questSetting[i].questCondition == Quest_Data.QuestCondition.Hunting)
                    {
                        questData.questSetting[i].idCondition.x = EditorGUILayout.IntField("Enemy ID", (int)questData.questSetting[i].idCondition.x);
                        questData.questSetting[i].idCondition.y = EditorGUILayout.IntField("Amount", (int)questData.questSetting[i].idCondition.y);
                    }
                    else
                    {
                        questData.questSetting[i].idCondition.x = EditorGUILayout.IntField("Item ID", (int)questData.questSetting[i].idCondition.x);
                        questData.questSetting[i].idCondition.y = EditorGUILayout.IntField("Amount", (int)questData.questSetting[i].idCondition.y);
                    }

                    EditorGUILayout.Space();
                    EditorGUILayout.LabelField("Item Reward", "");
                    questData.questSetting[i].itemIDReward.x = EditorGUILayout.IntField("Item ID", (int)questData.questSetting[i].itemIDReward.x);
                    questData.questSetting[i].itemIDReward.y = EditorGUILayout.IntField("Amount", (int)questData.questSetting[i].itemIDReward.y);

                    EditorGUILayout.Space();
                    questData.questSetting[i].repeatQuest = EditorGUILayout.Toggle("Can Repeat", questData.questSetting[i].repeatQuest);

                    EditorGUILayout.Space();
                    EditorGUILayout.Space();
                }
            }
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(questData);
        }
    }