public void Execute(SkillDeployer deployer) { // foreach (var t in deployer.SkillData.attackTargets) { Vector3 force = (t.position - deployer.gameObject.transform.position) * 10f; t.transform.gameObject.GetComponent <Rigidbody2D>().AddForce(force); } }
public void Execute(SkillDeployer deployer) { foreach (var t in deployer.SkillData.attackTargets) { float damage = deployer.SkillData.atkRatio * 0.01f * deployer.SkillData.owner.transform.GetComponent <CharaterStatus>().baseATK; t.GetComponent <CharaterStatus>().Hp -= damage; //t.GetComponent<DamageNumGenerator>().CreateDamageNum(damage,1f,0.5f); t.GetComponent <Enemy>().SetHurtFlash(); } }
/// <summary> /// 生成技能 /// </summary> public void GenerateSkill(SkillData data) { //Debug.Log(data.prefabName+data.skillprefab.name); //创建技能 GameObject skillGo = GameObjectPool.Instance.CreateObject(data.prefabName, data.skillprefab, transform.position, GeneratePoint.rotation); //获取技能释放器 SkillDeployer deployer = skillGo.GetComponent <SkillDeployer>(); //传递技能数据给释放器 deployer.SkillData = data; //内部创建算法对象 deployer.DeploySkill(); //内部执行算法对象 //延时销毁重置技能 GameObjectPool.Instance.CollectObject(skillGo, data.durationTime); //开启技能冷却 StartCoroutine(CoolTimeDown(data)); }
public void Execute(SkillDeployer deployer) { var status = deployer.SkillData.owner.GetComponent <CharaterStatus>(); status.Sp -= deployer.SkillData.costSp; }