public ParticlePlumeEffect(ActiveObject bindToObject, TimeSpan duration, PlumeType type) { Type = type; LastTick = Game1.CurrentTime; Duration = duration; BindToObject = bindToObject; AddParticles(MAX_PARTICLES); }
public TeleportEffect(ActiveObject bindToObject, TimeSpan duration, Events callbackEvent, object parameter) { LastTick = Game1.CurrentTime; Duration = duration; CallbackEvent = callbackEvent; Parameter = parameter; BindToObject = bindToObject; float startX = BindToObject.DrawBox.Left; float startY = BindToObject.DrawBox.Bottom; StartPosition = new Vector2(startX, startY); AddParticles(MAX_PARTICLES); }
public bool ShootAtObject(ActiveObject obj) { if (!obj.CanBeShot) return false; // Check distance float distance = obj.DrawBox.Center.Distance(DrawBox.Center); if (distance < ShootRange) { if (State == PlayerStates.Walking) Stop(); if (State == PlayerStates.Standing || State == PlayerStates.Shooting) { ShootTarget = obj; State = PlayerStates.Shooting; Game1.EventMan.Notify(Events.PlayerShootsObj, new ActiveObject[] { this, obj }); return true; } } return false; }
public void PlayerPickedUpByIcydactyl(object icydactylObj) { AttachedTo = (ActiveObject)icydactylObj; State = PlayerStates.Carried; }
public virtual bool WillCollide(ActiveObject obj) { float distance = GetDistance(obj) - (obj.Velocity.X * LastTimeDelta); return distance < (Hitbox.Width + obj.Hitbox.Width) / 2; }
public virtual bool IsCollide(ActiveObject obj) { return GetDistance(obj) < (Hitbox.Width + obj.Hitbox.Width) / 2; }
public virtual float GetOverlap(ActiveObject obj) { return GetDistance(obj) - obj.Hitbox.Width / 2; }
public virtual float GetDistance(ActiveObject obj) { return Vector2.Distance(Center, obj.Center); //return Hitbox.Center.Distance(obj.Hitbox.Center); }
public virtual float DistanceXCenter(ActiveObject obj) { float thisCenter = DrawBox.Center.X - DrawBox.Width / 2; float objCenter = obj.DrawBox.Center.X - obj.DrawBox.Width / 2; return Math.Abs(objCenter - thisCenter); }