public Vector3 Deflect(s_Projectile p)
    {
        if (p.GetPenetrationsLeft() < CanDeflectPentrationsUpTo)
        {
            switch (TypeOfDeflection)
            {
            case DeflectionType.NoDeflection:
                return(p.GetMoveDirection());

            case DeflectionType.DefaultDeflection:
                return(deflectionDirection(-p.GetMoveDirection(), p.GetDeflectionSpread()));

            case DeflectionType.OverrideProjectileDeflection:
                return(deflectionDirection(-p.GetMoveDirection(), DeflectionJitter));

            case DeflectionType.DeflectForward:
                return(holder.GetAimDirection());

            case DeflectionType.ExactReflection:
                return(-p.GetMoveDirection());

            default:
                return(p.GetMoveDirection());
            }
        }
        return(p.GetMoveDirection());
    }
예제 #2
0
    //the acutal fire function, this is customized to the spesific weapon and is what produces the actual projectile
    protected override void fireWeapon()
    {
        if (m_enableMuzzleFlash)
        {
            switch (HowToHoldWeapon)
            {
            case WeaponHoldingType.OneHandedMelee:
                break;

            case WeaponHoldingType.TwoHandedMelee:
                break;

            case WeaponHoldingType.OneHandedRanged:
                s_GameManager.Singleton.GetVFXSpawner().GetVFXOfType(WarboticsEnums.VFX.MuzzleFlashOneHanded).OnSpawn(m_pointForBullets.transform.position);
                break;

            case WeaponHoldingType.TwoHandedRanged:
                s_GameManager.Singleton.GetVFXSpawner().GetVFXOfType(WarboticsEnums.VFX.MuzzleFlashTwoHanded).OnSpawn(m_pointForBullets.transform.position);
                break;

            case WeaponHoldingType.OneHandedThrown:
                break;

            default:
                break;
            }
        }
        s_Projectile p = GetProjectileForGun();

        p.ShowDebug = ShowDebug;
        p.OnSpawn(holder,
                  GetFireDirectionAndRecoil(),
                  ProjectileMoveRate + speedModifer(),
                  damage,
                  new float[] { lifeTimeOfProjectileMin, lifeTimeOfProjectileMax },
                  WillCollideWith,
                  TrackingShot,
                  AreaOfEffect,
                  AreaOfEffectForce,
                  TypeOfEffect,
                  KnockBackForce,
                  KnockBackJitter,
                  LengthOfStun,
                  LengthOfSlow,
                  SlowPercentage,
                  Deflectable,
                  CreateBounce(),
                  (DetonateOnProximity ? CreateDetonate() : null),
                  (Aura ? CreateAura() : null),
                  Penetrates,
                  IsMine,
                  DestroyedByProjectiles,
                  MineSticksToFloor,
                  (IsMine ? CreateMine() : null),
                  (m_pointForBullets == null ? Vector3.zero : m_pointForBullets.transform.position)
                  );
    }