예제 #1
0
    public void Active(ActionController target, FCBullet owner)
    {
        _target = target;

        _myTransform.localPosition = _pool._core.position;
        _targetTransform           = target.ACGetTransformByName(_targetPart);
        gameObject.SetActive(true);

        _timer = -1.0f;         // delay 1st hurt to update.
        // init hurt parameter.
        _fastCommand._param1 = _pool;
        _fastCommand._cmd    = FCCommand.CMD.HURT;
        _fastCommand._param2 = _target;
        _fastCommand._param3 = 0;
        _owner = owner;
    }
예제 #2
0
 public void RefreshPorts(ActionController ac)
 {
     if (_firePointNames != null && _firePointNames.Length != 0)
     {
         _firePoints = new Transform[_firePointNames.Length];
         for (int i = 0; i < _firePointNames.Length; i++)
         {
             _firePoints[i] = ac.ACGetTransformByName(_firePointNames[i]);
         }
         _fireAngleTotal  = _fireAngleRight - _fireAngleLeft;
         _fireAngleTotalY = _fireAngleUp - _fireAngleDown;
         if (_angleStep > 0)
         {
             _angleOffest = _fireAngleTotal / _angleStep;
         }
         else
         {
             _angleOffest = 0;
         }
         _damageScale = _damageScaleSource;
     }
 }
예제 #3
0
    public static void HandleHit(ActionController owner, AttackUnit attackUnit, FC_DAMAGE_TYPE damageType, ActionController target)
    {
        if (owner.IsAlived)
        {
            if (owner.ACGetCurrentAttack() != null)
            {
                owner.ACIsHitTarget(target, attackUnit.GetSharpness(), owner.ACGetCurrentAttack()._hitGainEnergy, attackUnit.GetAttackInfo()._isFromSkill);
            }
            else
            {
                owner.ACIsHitTarget(target, 0, false, attackUnit.GetAttackInfo()._isFromSkill);
            }
        }
        if (attackUnit.GetAttackInfo()._damageType != FC_DAMAGE_TYPE.NONE)
        {
            damageType = attackUnit.GetAttackInfo()._damageType;
        }
        if (damageType != FC_DAMAGE_TYPE.NONE &&
            !(target.SuperArmorSelf.ActiveArmor() == FCConst.SUPER_ARMOR_LVL2 &&
              target.SuperArmorSelf.DamageAbsorb(FCConst.SUPER_ARMOR_LVL2) > 0.99f))
        {
            //play blood effect
            Vector3 bloodPos = target.ACGetTransformByName(EnumEquipSlot.belt).position;


            //play blood on ground with random rotation
            int        rotY           = Random.Range(0, 360);
            Quaternion rot            = Quaternion.Euler(0, rotY, 0);
            Vector3    bloodGroundPos = target.ACGetTransformByName(EnumEquipSlot.foot_point).position;
            bloodGroundPos.y -= target.SelfMoveAgent.GetFlyHeight();
            GlobalEffectManager.Instance.PlayEffect(FC_GLOBAL_EFFECT.BLOOD_GROUND, bloodGroundPos, rot);

            //play effect by damage type
            switch (damageType)
            {
            case FC_DAMAGE_TYPE.PHYSICAL:
            {
                if (target.HasBloodEffect)
                {
                    //play physical attack effect
                    GlobalEffectManager.Instance.PlayEffect(FC_GLOBAL_EFFECT.ATTACK_PHYSICAL
                                                            , bloodPos);

                    GlobalEffectManager.Instance.PlayEffect(FC_GLOBAL_EFFECT.BLOOD
                                                            , bloodPos);
                }
            }
            break;

            case FC_DAMAGE_TYPE.FIRE:
            {
                CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.FIRE_ATTACK
                                                           , target._avatarController, -1);
            }
            break;

            case FC_DAMAGE_TYPE.POISON:
            {
                CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.DAMAGE_POISON
                                                           , target._avatarController, -1);
            }
            break;

            case FC_DAMAGE_TYPE.ICE:
            {
                CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.DAMAGE_ICE
                                                           , target._avatarController, -1);
            }
            break;

            case FC_DAMAGE_TYPE.THUNDER:
            {
                CharacterEffectManager.Instance.PlayEffect(FC_CHARACTER_EFFECT.DAMAGE_THUNDER
                                                           , target._avatarController, -1);
            }
            break;

            default:
            {
                Assertion.Check(false, "now we do not support this type damage");
            }
            break;
            }
        }
    }