]> git.r.bdr.sh - rbdr/super-polarity/blobdiff - SuperPolarity/ActorManager.cs
Update project to work on VS Code mac
[rbdr/super-polarity] / SuperPolarity / ActorManager.cs
index 56db26c1570603128a1d8493cd6081b900e9d7e3..3a9b0db9c826f7448e24ddd4f4cc3344ad70d4cb 100644 (file)
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -47,6 +47,11 @@ namespace SuperPolarity
             foreach (Actor actor in Actors)
             {
                 actor.Draw(spriteBatch);
             foreach (Actor actor in Actors)
             {
                 actor.Draw(spriteBatch);
+
+                               if (actor.GetType ().IsAssignableFrom (typeof(MainShip))) {
+                                       var mainActor = (MainShip)actor;
+                                       mainActor.ResetEnemyModification ();
+                               }
             }
         }
 
             }
         }
 
@@ -102,6 +107,16 @@ namespace SuperPolarity
                 var angle = (float) Math.Atan2(dy, dx);
                 var otherAngle = (float)Math.Atan2(-dy, -dx);
 
                 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);
                 if (linearDistance < actor.MagneticRadius || linearDistance < other.MagneticRadius)
                 {
                     actor.Magnetize(other, (float)linearDistance, angle);