Example #1
0
    public virtual void Apply(Data.EffectData data, float time, Vector3 direction, Vector3 position)
    {
        if (data.damage.value != 0f)
        {
            healthEffects.Add(new AppliedEffect(time, data.damage));
        }

        if (data.shield.value != 0f)
        {
            shieldEffects.Add(new AppliedEffect(time, data.shield));
        }

        if (data.blindness.value != 0f)
        {
            sightEffects.Add(new AppliedEffect(time, data.blindness));
        }

        if (data.speed.value != 1f)
        {
            speedEffects.Add(new AppliedEffect(time, data.speed));
        }

        if (data.rof.value != 1f)
        {
            rofEffects.Add(new AppliedEffect(time, data.rof));
        }
    }
Example #2
0
    public void Apply(Data.EffectData data, float time, Vector3 direction, Vector3 position)
    {
        if (data.damage.value != 0f)
        {
            healthEffects.Add(new Affectable.AppliedEffect(time, data.damage));
        }
        //Accumulate damage for a frame, and break should it be too much (implementation in subweapon)
        //framerate affecting this is bad
        //It could be an easy source of difference between server and client
        //  mostly due to differing framerates, and projectiles not being executed in the same order
        //  The shield can't break mid-update due to projectiles arriving at possibly different times in a single frame
        //question is, will it bring more desynchronization than differing framerate and user input
        //let's admit I wanted to do this right
        //  if the shield breaks, it needs to respawn all the projectiles that hit it, from the exact moment it broke
        //  this is a pain, but doable
        //  Simply reactivating them and calling Update should do the trick
        //      Maybe
        //          But doesn't work for explosions, and other weird stuff
        //OR
        //  shield explodes for accumulated damage minus some supposed to take in account change of missing
        //  would make you want to avoid having your shield break, and deactivating it instead
        //  this reduces the chances of shield breaking in advanced matches, otherwise it kinda sucks

        //There will always be differences between server and client
        //framerates, user control, some more minor stuff
        //This is an advantage for users with poor framerates, but they are disadvanteged otherwise
    }
Example #3
0
    public override void Apply(Data.EffectData data, float time, Vector3 direction, Vector3 position)
    {
        base.Apply(data, time, direction, position);

        if (data.knockback != 0f && GetComponent <Rigidbody>() && direction.sqrMagnitude != 0f)
        {
            GetComponent <Rigidbody>().AddForceAtPosition(direction.normalized * data.knockback, position, ForceMode.VelocityChange);
        }
    }
Example #4
0
    public Projectile InitProjectile(IWeapon parent, Vector3 position, Quaternion rotation, float timeOfShot, Data.ProjectileData data, Data.EffectData effect)
    {
        GameObject go = base.GetItem();

        Projectile proj = go.GetComponent <Projectile>();

        proj.Init(parent, position, rotation, timeOfShot, data, effect);

        return(proj);
    }