-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
foreach (Actor actor in Actors)
{
actor.Draw(spriteBatch);
+
+ if (actor.GetType ().IsAssignableFrom (typeof(MainShip))) {
+ var mainActor = (MainShip)actor;
+ mainActor.ResetEnemyModification ();
+ }
}
}
{
Actor other = Actors[j];
- CheckCollision(actor, other);
+ if (actor.Collides && other.Collides) {
+ CheckCollision(actor, other);
+ }
if (actor.GetType().IsSubclassOf(typeof(Ship)) && other.GetType().IsSubclassOf(typeof(Ship)))
{
var angle = (float) Math.Atan2(dy, dx);
var otherAngle = (float)Math.Atan2(-dy, -dx);
+ if (actor.GetType ().IsAssignableFrom (typeof(MainShip))) {
+ var mainActor = (MainShip)actor;
+ mainActor.UpdateEnemyModification (other);
+ }
+
+ if (other.GetType ().IsAssignableFrom (typeof(MainShip))) {
+ var mainOther = (MainShip)other;
+ mainOther.UpdateEnemyModification (actor);
+ }
+
if (linearDistance < actor.MagneticRadius || linearDistance < other.MagneticRadius)
{
actor.Magnetize(other, (float)linearDistance, angle);