public void Setup(int seat) { if (transform.parent.name.Contains("Hero")) { CombatEntity = CombatContext.Instance.AddHeroEntity(seat); } if (transform.parent.name.Contains("Monster")) { CombatEntity = CombatContext.Instance.AddMonsterEntity(seat); } CombatEntity.CurrentHealth.SetMaxValue(999); CombatEntity.CurrentHealth.Reset(); CombatObjectData = GetComponent <CombatObjectData>(); SeatPoint = transform.position; CombatEntity.ModelObject = gameObject; CombatEntity.ListenActionPoint(ActionPointType.PreJumpTo, OnPreJumpTo); CombatEntity.ListenActionPoint(ActionPointType.PreGiveAttack, OnPreAttack); CombatEntity.ListenActionPoint(ActionPointType.PostGiveAttack, OnPostAttack); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveDamage, OnReceiveDamage); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveCure, OnReceiveCure); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveStatus, OnReceiveStatus); CombatEntity.Subscribe <RemoveStatusEvent>(OnRemoveStatus); CombatEntity.Subscribe <DeadEvent>(OnDead); //var config = Resources.Load<StatusConfigObject>("StatusConfigs/Status_Tenacity"); //var Status = CombatEntity.AttachStatus<StatusTenacity>(config); //Status.Caster = CombatEntity; //Status.TryActivateAbility(); }
// Start is called before the first frame update void Start() { CombatEntity = Entity.CreateWithParent <CombatEntity>(CombatContext.Instance); CombatEntity.Position = transform.position; CombatEntity.AddComponent <MotionComponent>(); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveDamage, OnReceiveDamage); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveCure, OnReceiveCure); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveStatus, OnReceiveStatus); CombatEntity.Subscribe <RemoveStatusEvent>(OnRemoveStatus).AsCoroutine(); var config = Resources.Load <StatusConfigObject>("StatusConfigs/Status_Tenacity"); var Status = CombatEntity.AttachStatus <StatusTenacity>(config); Status.Caster = CombatEntity; Status.TryActivateAbility(); }
// Start is called before the first frame update void Start() { CombatEntity = EntityFactory.Create <CombatEntity>(); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveDamage, OnReceiveDamage); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveCure, OnReceiveCure); if (name == "Monster") { CombatEntity.ListenActionPoint(ActionPointType.PostReceiveStatus, ReceiveStatus); CombatEntity.Subscribe <StatusRemoveEvent>(OnStatusRemove).AsCoroutine(); } var config = Resources.Load <StatusConfigObject>("StatusConfigs/Status_Tenacity_坚韧"); var Status = CombatEntity.AttachStatus <StatusTenacity>(config); Status.Caster = CombatEntity; Status.TryActivateAbility(); }
public virtual void Setup() { MonsterObjectData = GetComponent <MonsterObjectData>(); SeatPoint = transform.position; CombatEntity.ModelObject = gameObject; CombatEntity.ListenActionPoint(ActionPointType.PreGiveAttack, OnPreAttack); CombatEntity.ListenActionPoint(ActionPointType.PostGiveAttack, OnPostAttack); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveDamage, OnReceiveDamage); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveCure, OnReceiveCure); CombatEntity.ListenActionPoint(ActionPointType.PostReceiveStatus, OnReceiveStatus); CombatEntity.Subscribe <RemoveStatusEvent>(OnRemoveStatus).AsCoroutine(); //var config = Resources.Load<StatusConfigObject>("StatusConfigs/Status_Tenacity"); //var Status = CombatEntity.AttachStatus<StatusTenacity>(config); //Status.Caster = CombatEntity; //Status.TryActivateAbility(); }
// Start is called before the first frame update void Start() { Instance = this; CombatEntity = Entity.CreateWithParent <CombatEntity>(CombatContext.Instance); CombatEntity.AddComponent <SkillPreviewComponent>(); CombatEntity.AddComponent <EquipmentComponent>(); //CombatEntity.GetComponent<MotionComponent>().Enable = false; CombatEntity.ListenActionPoint(ActionPointType.PreSpell, OnPreSpell); CombatEntity.ListenActionPoint(ActionPointType.PostSpell, OnPostSpell); CombatEntity.Subscribe <AnimationClip>(OnPlayAnimation); #if EGAMEPLAY_EXCEL var config = ConfigHelper.Get <SkillConfig>(1001); SkillAbility ability = CombatEntity.AttachSkill <SkillAbility>(config); CombatEntity.BindSkillInput(ability, KeyCode.Q); config = ConfigHelper.Get <SkillConfig>(1002); ability = CombatEntity.AttachSkill <SkillAbility>(config); CombatEntity.BindSkillInput(ability, KeyCode.W); config = ConfigHelper.Get <SkillConfig>(1004); ability = CombatEntity.AttachSkill <SkillAbility>(config); CombatEntity.BindSkillInput(ability, KeyCode.E); SkillSlotsTrm.Find("SkillButtonD").gameObject.SetActive(false); SkillSlotsTrm.Find("SkillButtonE").gameObject.SetActive(false); #else SkillConfigObject config = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1001_黑火球术"); SkillAbility ability = CombatEntity.AttachSkill <SkillAbility>(config); CombatEntity.BindSkillInput(ability, KeyCode.Q); config = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1002_炎爆"); ability = CombatEntity.AttachSkill <SkillAbility>(config); CombatEntity.BindSkillInput(ability, KeyCode.W); config = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1004_血红激光炮"); ability = CombatEntity.AttachSkill <SkillAbility>(config); CombatEntity.BindSkillInput(ability, KeyCode.E); config = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1005_火弹"); ability = CombatEntity.AttachSkill <SkillAbility>(config); CombatEntity.BindSkillInput(ability, KeyCode.R); config = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1006_灵魂镣铐"); ability = CombatEntity.AttachSkill <SkillAbility_1006>(config); CombatEntity.BindSkillInput(ability, KeyCode.T); config = Resources.Load <SkillConfigObject>("SkillConfigs/Skill_1003_治愈"); ability = CombatEntity.AttachSkill <SkillAbility>(config); CombatEntity.BindSkillInput(ability, KeyCode.Y); #endif for (int i = InventoryPanelTrm.childCount; i > 0; i--) { GameObject.Destroy(InventoryPanelTrm.GetChild(i - 1).gameObject); } var allItemConfigs = ConfigHelper.GetAll <EquipmentConfig>(); foreach (var item in allItemConfigs) { var itemObj = GameObject.Instantiate(ItemPrefab); itemObj.transform.parent = InventoryPanelTrm; itemObj.transform.Find("Icon").GetComponent <UnityEngine.UI.Image>().sprite = Resources.Load <Sprite>($"Icons/{item.Value.Name}"); var text = itemObj.transform.Find("Text").GetComponent <UnityEngine.UI.Text>(); text.text = $"+{item.Value.Value}"; if (item.Value.Attribute == "AttackPower") { text.color = Color.red; } itemObj.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => { if (EquipmentPanelTrm.childCount >= 4) { return; } var equipObj = GameObject.Instantiate(ItemPrefab); equipObj.transform.parent = EquipmentPanelTrm; equipObj.transform.Find("Icon").GetComponent <UnityEngine.UI.Image>().sprite = Resources.Load <Sprite>($"Icons/{item.Value.Name}"); var equipText = equipObj.transform.Find("Text").GetComponent <UnityEngine.UI.Text>(); equipText.text = $"+{item.Value.Value}"; if (item.Value.Attribute == "AttackPower") { equipText.color = Color.red; } var itemData = Entity.CreateWithParent <ItemData>(CombatEntity); equipObj.name = $"{itemData.Id}"; itemData.ConfigId = item.Value.Id; CombatEntity.GetComponent <EquipmentComponent>().AddItemData(itemData); equipObj.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(() => { var id = long.Parse(equipObj.name); CombatEntity.GetComponent <EquipmentComponent>().RemoveItemData(id); GameObject.Destroy(equipObj); }); }); } AnimTimer.MaxTime = AnimTime; }