Example #1
0
        public override bool OnCollision(Fixture f1, Fixture f2, Contact contact)
        {
            CollidingSprite other = SyncedGameCollection.GetCollisionComponent(f2);

            if (other.Tag == TagCategories.CRYSTAL)
            {
                if (Item == null)
                {
                    Crystal crystal = other as Crystal;
                    Item = crystal.PickUp(this, _teamColor);
                }
                return(false);
            }
            else if (other.Tag == TagCategories.UNIT)
            {
                return(false);
            }
            else if (other.Tag == TagCategories.COMPACTZONE)
            {
                if (Item == null)
                {
                    CompactZone compactzone = other as CompactZone;
                    Item = compactzone.PickUp(this, _teamColor);
                }
            }
            else if (other.Tag == TagCategories.BARRIER)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        public override bool OnCollision(Fixture f1, Fixture f2, Contact contact)
        {
            CollidingSprite other = SyncedGameCollection.GetCollisionComponent(f2);

            if (other.Tag == TagCategories.UNIT)
            {
                return(false);
            }

            return(true);
        }
Example #3
0
        public override bool OnCollision(Fixture f1, Fixture f2, FarseerPhysics.Dynamics.Contacts.Contact contact)
        {
            CollidingSprite other = SyncedGameCollection.GetCollisionComponent(f2);

            if (other != null)
            {
                if (other.Tag == TagCategories.UNIT)
                {
                    Color = Color.Magenta;
                    return(false);
                }
            }
            return(false);
        }
 public static CollidingSprite GetCollisionComponent(Fixture other)
 {
     foreach (GameComponent gc in ComponentCollection)
     {
         if (gc is CollidingSprite)
         {
             CollidingSprite cs = (CollidingSprite)gc;
             if (cs.ID.ToString() == other.Body.UserData.ToString())
             {
                 return(cs);
             }
         }
     }
     return(new DummyComponent());
 }
Example #5
0
        public override bool OnCollision(Fixture f1, Fixture f2, FarseerPhysics.Dynamics.Contacts.Contact contact)
        {
            CollidingSprite other = SyncedGameCollection.GetCollisionComponent(f2);

            if (other != null)
            {
                if (other is IVictim)
                {
                    if (!_victims.Contains((IVictim)other))
                    {
                        _victims.Add((IVictim)other);
                    }
                }
            }
            return(false);
        }
Example #6
0
        public bool OnCollision(Fixture f1, Fixture f2, Contact contact)
        {
            CollidingSprite crystal = SyncedGameCollection.GetCollisionComponent(f2);

            if (crystal.Tag == TagCategories.CRYSTAL)
            {
                if (Scored != null)
                {
                    PlayerIndex p = (crystal as Crystal).GetPlayerIndex();
                    if ((int)p != -1)
                    {
                        Scored(p);
                        Library.Audio.PlaySoundEffect(Library.Audio.SoundEffects.Score);
                    }
                }
                return(false);
            }
            return(true);
        }
Example #7
0
        public override bool OnCollision(Fixture f1, Fixture f2, FarseerPhysics.Dynamics.Contacts.Contact contact)
        {
            CollidingSprite other = SyncedGameCollection.GetCollisionComponent(f2);

            if (other != null)
            {
                if (other is IVictim)
                {
                    if (!_victims.Contains((IVictim)other))
                    {
                        if (other is Unit)
                        {
                            if (_evilCrystalList.Count + _evilUnitList.Count > _maximumBunshin && _evilUnitList.Count > 0)
                            {
                                world.RemoveBody(_evilUnitList[0].RigidBody);
                                SyncedGameCollection.ComponentCollection.Remove(_evilUnitList[0]);
                                _evilUnitList.RemoveAt(0);
                            }
                            CreateVictimBunshin((IVictim)other);
                            _victims.Add((IVictim)other);
                        }
                        else if (other is Crystal)
                        {
                            if (_evilCrystalList.Count + _evilUnitList.Count > _maximumBunshin && _evilCrystalList.Count > 0)
                            {
                                world.RemoveBody(_evilCrystalList[0].RigidBody);
                                SyncedGameCollection.ComponentCollection.Remove(_evilCrystalList[0]);
                                _evilCrystalList.RemoveAt(0);
                            }
                            CreateVictimBunshin((IVictim)other);
                            _victims.Add((IVictim)other);
                        }
                    }
                }
            }
            return(false);
        }