Exemple #1
0
 public void addWO(WorldObject wo)
 {
     wo.addThis += new addThisEventHandler(wo_addThis);
     wo.destroyMe += new destroyMeEventHandler(wo_destroyMe);
     wo.objectMessageEvent += new objectMessageEventHandler(wo_objectMessageEvent);
     this.objects.Add(wo);
 }
Exemple #2
0
 public override void Init(Microsoft.Xna.Framework.Content.ContentManager content)
 {
     base.Init(content);
     this.texture = new AnimatedTexture2D(content.Load<Texture2D>(FileNames.turret1), 80, animationSub.def);
     this.blocks = true;
     this.collider = new CircleCollider(new Vector2(40, 40), 38);
     if(this.type == "TurretTrack")
     {
         this.target = Game1.hacks;
     }
     if(props.ContainsKey("endAngle"))
     {
         this.endAngle = MathHelper.ToRadians(float.Parse(props["endAngle"]));
     }
     if(props.ContainsKey("rateOfFire"))
     {
         this.rateOfFire = int.Parse(props["rateOfFire"]);
     }
     if(props.ContainsKey("rateofRotation"))
     {
         this.rateofRotation = MathHelper.ToRadians(float.Parse(props["rateofRotation"]));
     }
     if(props.ContainsKey("rotationsFiring"))
     {
         this.rotationsFiring = int.Parse(props["rotationsFiring"]);
     }
     if(props.ContainsKey("rotationsIdle"))
     {
         this.rotationsIdle = int.Parse(props["rotationsIdle"]);
     }
     if(props.ContainsKey("startAngle"))
     {
         this.startAngle = MathHelper.ToRadians(float.Parse(props["startAngle"]));
     }
     this.angle = this.startAngle;
 }
Exemple #3
0
 void newFriend_destroyMe(WorldObject sender, Boolean dyrmi)
 {
     sender.destroyMe += new destroyMeEventHandler(newFriend_destroyMe);
     friends.Remove(sender);
 }
Exemple #4
0
 public virtual void onAddThis(WorldObject newObject)
 {
     if (addThis != null)
     {
         addThis(this, newObject);
     }
 }
Exemple #5
0
 public virtual Boolean hits(WorldObject wo)
 {
     if (collider == null || wo.collider == null) return false;
     if (this.friends.Contains(wo) || wo.friends.Contains(this)) return false;
     return collider.hit(wo.collider, hitPosition, wo.hitPosition);
 }
Exemple #6
0
 public void addFriend(WorldObject newFriend)
 {
     newFriend.destroyMe += new destroyMeEventHandler(newFriend_destroyMe);
     friends.Add(newFriend);
 }
Exemple #7
0
 public void Update(GameTime gameTime)
 {
     WorldObject[] wos = objects.ToArray();
     for (int i = 0; i < wos.Length; i++)
     {
         for (int j = i+1; j < wos.Length; j++)
         {
             if (wos[i].hits(wos[j]))
             {
                 if (wos[i].blocks) wos[j].hitBlocks = true;
                 if (wos[i].destroys) wos[j].hitdestroys = true;
                 if (wos[j].blocks) wos[i].hitBlocks = true;
                 if (wos[j].destroys) wos[i].hitdestroys = true;
                 if (wos[i].triggers) wos[j].hitTriggers = true;
                 if (wos[j].triggers) wos[i].hitTriggers = true;
             }
         }
         if (!wos[i].hitBlocks)
         {
             if (wos[i].hits(map))
             {
                 //AWESOME F*****G HACK
                 if (wos[i].GetType() == typeof(PlayerObject))
                 {
                     PlayerObject po = (PlayerObject)wos[i];
                     Vector2 hold = po.hack2;
                     po.setVelocity(po.hack1);
                     if (!po.hits(map)) continue;
                     po.setVelocity(hold);
                     if (!po.hits(map)) continue;
                 }
                 wos[i].hitBlocks = true;
             }
         }
         if (wos[i].position.X < -100 || wos[i].position.Y < -100 || wos[i].position.X > 1124 || wos[i].position.Y > 868)
         {
             wos[i].onDestroyMe();
         }
     }
     WorldObject[] war = new WorldObject[objects.Count];
     objects.CopyTo(war);
     foreach (WorldObject wo in war)
     {
         wo.Update(gameTime);
         wo.hitBlocks = false;
         wo.hitdestroys = false;
         wo.hitTriggers = false;
     }
 }
Exemple #8
0
 void wo_objectMessageEvent(WorldObject sender, objectMessageEventArgs args)
 {
     if (args.messageType == objectMessageType.redButton)
     {
         if (redButtonEvent != null)
         {
             redButtonEvent();
         }
     }
     else
     {
         if (lootEvent != null)
         {
             lootEvent(args.cash);
         }
     }
 }
Exemple #9
0
 void wo_destroyMe(WorldObject sender, Boolean dyrmi)
 {
     this.objects.Remove(sender);
     sender.addThis -= new addThisEventHandler(wo_addThis);
     sender.destroyMe -= new destroyMeEventHandler(wo_destroyMe);
     sender.objectMessageEvent -= new objectMessageEventHandler(wo_objectMessageEvent);
 }
Exemple #10
0
        void wo_addThis(WorldObject sender, WorldObject newObject)
        {
            newObject.Init(hehehe);
            newObject.addThis += new addThisEventHandler(wo_addThis);
            newObject.destroyMe += new destroyMeEventHandler(wo_destroyMe);

            this.objects.Add(newObject);
        }
Exemple #11
0
 void player_destroyMe(WorldObject sender, Boolean dyrmi)
 {
     if (dyrmi)
     {
         Console.WriteLine("DEAAAAAAAAAAAAAAAAAD");
         this.defeat = true;
     }
 }