示例#1
0
        public override bool LightAttack()
        {
            if (!base.LightAttack())
            {
                return(false);
            }
            if (weaponCenter.Length == 0)
            {
                return(false);
            }

            state.IsLightAttack = true;         // may bug
            ChangeAnim(anim.lightAttack);
            LightAttackAttrs skillAttrs = skills.lightAttackAttrs;

            foreach (Transform hit in weaponCenter)
            {
                Collider[] colliders = Physics.OverlapSphere(hit.position, skillAttrs.radius, 1 << LayerMask.NameToLayer("Character"));
                foreach (Collider collider in colliders)
                {
                    if (collider.gameObject.name == this.gameObject.name)
                    {
                        continue;
                    }
                    Character other = collider.gameObject.GetComponent <Character>();
                    other.TakeDamage(skillAttrs.power);
                }
            }
            return(true);
        }
示例#2
0
        public override bool LightAttack()
        {
            if (!base.LightAttack())
            {
                return(false);
            }
            if (skills.lightAttackAttrs.waitTime >= 0)
            {
                return(false);
            }
            if (weaponCenter.Length == 0)
            {
                return(false);
            }

            state.IsLightAttack = true;
            ChangeAnim(anim.lightAttack);

            LightAttackAttrs  skillAttrs = skills.lightAttackAttrs;
            GameObject        magicBall  = Instantiate(extendObj.lightAttackParticle, weaponCenter[0].position, weaponCenter[0].rotation) as GameObject;
            MagicBallParicles paricles   = magicBall.transform.GetComponent <MagicBallParicles>();

            paricles.owner    = gameObject;
            paricles.lifeTime = skillAttrs.lifeTime;
            paricles.power    = skillAttrs.power;
            paricles.force    = skillAttrs.force;
            paricles.speed    = skillAttrs.speed;
            paricles.radius   = skillAttrs.radius;
            skills.lightAttackAttrs.waitTime = 0;
            return(true);
        }