Beispiel #1
0
 protected void objectEffect(BuffableObject obj, BuffableObject target)
 {
     target.states[(int)TypesOfStates.MovementLock] = ObjectStates.ControlLocked;
     target.states[(int)TypesOfStates.Status]       = ObjectStates.Stun;
     target.states[(int)TypesOfStates.Attack]       = ObjectStates.Idle;
     target.setVelocity(new Vector2(0, target.Velocity.Y));
 }
Beispiel #2
0
    protected void objectEffect(BuffableObject obj, BuffableObject target)
    {
        target.states[(int)TypesOfStates.MovementLock] = ObjectStates.ControlLocked;
        target.states[(int)TypesOfStates.Status]       = ObjectStates.Knockback;
        target.states[(int)TypesOfStates.Attack]       = ObjectStates.Idle;
        Vector2 vec   = target.Position - obj.Position;
        float   scale = (float)Math.Sqrt(Math.Pow(BuffableObject.KNOCKBACK_SPEED, 2) / (Math.Pow(Math.Abs(vec.X), 2) + Math.Pow(Math.Abs(vec.Y), 2)));

        target.setVelocity(scale * vec);
    }