123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- using NodeCanvas.DialogueTrees;
- using KairoEngine.Core;
- using KairoEngine.Inventory;
- using KairoEngine.Stats;
- namespace KairoEngine.CharacterSystem
- {
- [CreateAssetMenu(fileName = "Character", menuName = "KairoEngine/Character", order = 5)]
- [HideMonoScript]
- public class CharacterData : SerializedScriptableObject
- {
- [HorizontalGroup("Id1", 0.45f), HideLabel, PropertySpace(4, 2)] public string characterName;
- [HorizontalGroup("Id1", 0.2f), HideLabel, PropertySpace(4, 2)] public Race race;
- [HorizontalGroup("Id1", 0.15f), HideLabel, PropertySpace(4, 2)] public Gender gender;
-
- [HorizontalGroup("Id1", 0.2f), HideLabel, SuffixLabel("Years", true), PropertySpace(4, 2)] public int age;
- [HorizontalGroup("Id2", 0.45f), HideLabel, PropertySpace(4, 2)] public Faction faction;
- [HorizontalGroup("Id2", 0.35f), HideLabel, PropertySpace(4, 2)] public string id;
- [HorizontalGroup("Id2", 0.2f), HideLabel, Button("Randomize"), PropertySpace(4, 2)]
- public void RandomizeId() { id = KairoEngine.Core.Utilities.RandomString(12); }
-
- [InlineProperty, HideLabel, PropertySpace(12, 6)] public StatsController stats = new StatsController();
- [ListDrawerSettings(HideAddButton = false, HideRemoveButton = false, DraggableItems = true, Expanded = true, ShowPaging = false, ShowItemCount = true)]
- [PropertySpace(4, 8)] public List<ItemRef> itemList = new List<ItemRef>();
-
-
- [HorizontalGroup("Hitpoints"), SuffixLabel("HP", true), HideInInspector] public int hitpoints;
- [HorizontalGroup("Hitpoints", 0.3f), HideLabel, SuffixLabel("Max HP", true), HideInInspector] public int maxHitpoints;
- [HideInInspector] public int armor;
-
-
- #region Visuals
- [FoldoutGroup("Visuals")] public ModelData bodyModelData;
- private string _bodyModel = "";
- public string bodyModel
- {
- get
- {
- if(_bodyModel != "") return _bodyModel;
- else if(bodyModelData != null) return bodyModelData.name;
- else return "";
- }
- set
- {
- _bodyModel = value;
- }
- }
- [FoldoutGroup("Visuals"), Range(0, 3)] public int bodyMaterialNumber;
- private string _bodyMaterial = "";
- public string bodyMaterial
- {
- get
- {
- if(_bodyMaterial != "") return _bodyMaterial;
- else if(bodyModelData != null) return bodyModelData.materials[bodyMaterialNumber].name;
- else return "";
- }
- set
- {
- _bodyMaterial = value;
- }
- }
-
- [FoldoutGroup("Visuals")] public GameObject headAttachmentPrefab;
- private string _headAttachment = "";
- public string headAttachment
- {
- get
- {
- if(_headAttachment != "") return _headAttachment;
- else if(headAttachmentPrefab != null) return headAttachmentPrefab.name;
- else return "";
- }
- set
- {
- _headAttachment = value;
- }
- }
- [FoldoutGroup("Visuals")] public GameObject faceAttachmentPrefab;
- private string _faceAttachment = "";
- public string faceAttachment
- {
- get
- {
- if(_faceAttachment != "") return _faceAttachment;
- else if(faceAttachmentPrefab != null) return faceAttachmentPrefab.name;
- else return "";
- }
- set
- {
- _faceAttachment = value;
- }
- }
- [FoldoutGroup("Visuals"), Button("Check Visual Data Values")]
- public void CheckVisualData()
- {
- if(bodyModelData == null) Debug.LogError("No bodyModelData found in " + this.name, this);
- else Debug.Log(bodyModel + " / " + bodyMaterial, this);
- if(headAttachment != "") Debug.Log(headAttachment, headAttachmentPrefab);
- if(faceAttachment != "") Debug.Log(faceAttachment, faceAttachmentPrefab);
- if(bodyModelData != null) Debug.Log($"Visuals data OK for CharacterData \'{name}\'");
- else Debug.LogError($"Visuals data ERROR for CharacterData \'{name}\'");
- }
- #endregion
-
- [FoldoutGroup("State")] public DialogueTree dialogueTree;
- [FoldoutGroup("State"), LabelText("Sensor Hearing")] public bool hearing = true;
- [FoldoutGroup("State"), LabelText("Sensor Vision")] public bool vision = true;
- [FoldoutGroup("State")] public bool hasSpawned = false;
- [FoldoutGroup("State"), ShowIf("$hasSpawned")] public Vector3 position;
- [FoldoutGroup("State"), ShowIf("$hasSpawned")] public Quaternion rotation;
- [FoldoutGroup("State"), ShowIf("$hasSpawned")] public bool isDead = false;
- [FoldoutGroup("State"), ShowIf("@hasSpawned && isDead")] public List<DataBone> bones = new List<DataBone>();
-
- }
- public enum Gender
- {
- Male,
- Female,
- Other
- }
- public enum Race
- {
- Human,
- Inorganic,
- Reptilian,
- Ghoul
- }
- }
|