public void Spell_Damage(int damageValue)
    {
        TopDownCharacterCard tdcc = TopDownCharacterManager.instance.controllingCharacter.GetComponent <TopDownRpgSpellcaster>().previousTarget.GetComponent <TopDownCharacterCard>();

        if (tdcc != null)
        {
            tdcc.health -= damageValue;

            TopDownAI tdccAi = tdcc.GetComponent <TopDownAI>();

            if (tdccAi.playerInSight == false)
            {
                tdccAi.detected      = true;
                tdccAi.playerInSight = true;
                tdccAi.focus         = TopDownCharacterManager.instance.controllingCharacter.transform;
            }
        }
    }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        GUIStyle boldCenteredLabel = new GUIStyle(EditorStyles.boldLabel)
        {
            alignment = TextAnchor.MiddleCenter
        };

        GUIStyle simpleTitleLable = new GUIStyle(EditorStyles.boldLabel)
        {
            alignment = TextAnchor.MiddleLeft
        };

        EditorStyles.textField.wordWrap = true;

        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        EditorGUILayout.BeginVertical("Box", GUILayout.Width(90 * Screen.width / 100));
        EditorGUILayout.LabelField(new GUIContent(TopDownIcon), boldCenteredLabel, GUILayout.ExpandWidth(true), GUILayout.Height(32));
        EditorGUILayout.LabelField("- TOP DOWN RPG -", boldCenteredLabel);
        EditorGUILayout.LabelField("Character Info", boldCenteredLabel);
        EditorGUILayout.HelpBox("This is character info. If this character is playable you can also set character card from your asset folders. \nMainly this is used to store your character info or to set up your AI characters.", MessageType.Info);
        EditorGUILayout.EndVertical();
        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        if (td_target.gameObject.GetComponent <TopDownAI>())
        {
            EditorGUILayout.LabelField("AI COMPONENT DETECTED.", boldCenteredLabel);

            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginVertical("Box", GUILayout.Width(90 * Screen.width / 100));

            EditorGUILayout.LabelField("- AI Info -", boldCenteredLabel);

            EditorGUILayout.LabelField("Name:", simpleTitleLable);
            serializedObject.FindProperty("aiName").stringValue = EditorGUILayout.TextField(string.Empty, td_target.aiName);
            EditorGUILayout.HelpBox("This is the name of this AI.", MessageType.Info);

            EditorGUILayout.LabelField("Health:", simpleTitleLable);
            serializedObject.FindProperty("health").floatValue = EditorGUILayout.FloatField(string.Empty, td_target.health);
            EditorGUILayout.HelpBox("This is the starting health value of this AI.", MessageType.Info);

            EditorGUILayout.LabelField("Voice Set:", simpleTitleLable);
            serializedObject.FindProperty("aiVoiceSet").objectReferenceValue = (TopDownVoiceSet)EditorGUILayout.ObjectField(string.Empty, td_target.aiVoiceSet, typeof(TopDownVoiceSet), true);
            EditorGUILayout.HelpBox("If this is set then this AI will play configured voices in the game.", MessageType.Info);

            EditorGUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            //////////////////////////////////

            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginVertical("Box", GUILayout.Width(90 * Screen.width / 100));

            EditorGUILayout.LabelField("- AI Detect -", boldCenteredLabel);

            EditorGUILayout.LabelField("Field of View:", simpleTitleLable);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("aiFieldOfView"), true);
            //serializedObject.FindProperty("aiFieldOfView").intValue = EditorGUILayout.IntSlider((int)td_target.aiFieldOfView, 60, 180);
            EditorGUILayout.HelpBox("This represents field of view in which AI will detect player.", MessageType.Info);

            EditorGUILayout.LabelField("Detect Radius:", simpleTitleLable);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("aiDetectRadius"), true);
            //serializedObject.FindProperty("aiDetectRadius").intValue = EditorGUILayout.IntSlider((int)td_target.aiDetectRadius, 4, 20);
            EditorGUILayout.HelpBox("This represents radius of detection.", MessageType.Info);

            EditorGUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
        }
        if (td_target.GetComponent <TopDownControllerInteract>())
        {
            EditorGUILayout.LabelField("PLAYER DETECTED.", boldCenteredLabel);

            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginVertical("Box", GUILayout.Width(90 * Screen.width / 100));
            EditorGUILayout.LabelField("Character:", simpleTitleLable);
            serializedObject.FindProperty("character").objectReferenceValue = (TopDownCharacter)EditorGUILayout.ObjectField(string.Empty, td_target.character, typeof(TopDownCharacter), true);
            EditorGUILayout.HelpBox("Here we place our character from assets that we created earlier.", MessageType.Info);
            EditorGUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginVertical("Box", GUILayout.Width(90 * Screen.width / 100));

            EditorGUILayout.LabelField("- Player Info -", boldCenteredLabel);
            EditorGUILayout.HelpBox("Here You can preview your character info.", MessageType.Info);
            EditorGUILayout.Space();
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.LabelField("- Health and Energy -", simpleTitleLable);
            td_target.health = EditorGUILayout.FloatField("Health:", td_target.health);
            td_target.energy = EditorGUILayout.FloatField("Energy:", td_target.energy);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("- Equipment Modifiers -", simpleTitleLable);
            td_target.armorPoints  = EditorGUILayout.IntField("Armor Points:", td_target.armorPoints);
            td_target.damagePoints = EditorGUILayout.IntField("Damage Points:", td_target.damagePoints);
            EditorGUILayout.Space();
            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndVertical();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
        }
        if (td_target.gameObject.tag == "NPC")
        {
        }

        serializedObject.ApplyModifiedProperties();
    }