예제 #1
0
 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);
     }
 }
예제 #2
0
 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();
     }
 }
예제 #3
0
        /// <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));
        }
예제 #4
0
        public void Execute(SkillDeployer deployer)
        {
            var status = deployer.SkillData.owner.GetComponent <CharaterStatus>();

            status.Sp -= deployer.SkillData.costSp;
        }