Example #1
0
        public override void ReactToCollisionEntry(PhysicalObject other)
        {
            if (other is Missile)
            {
                GameWorld.Instance.AddObject(new Powerup(this.GetCentre()));
                AudioManager.Instance.PlayAudioClip(AudioManager.AUDIOCLIPS.BRILLIANT);
            }

            base.ReactToCollisionEntry(other);
        }
Example #2
0
        //Called every tick that a collision is detected
        public override void ReactToCollision(PhysicalObject other)
        {
            if (other is Cloud)
            {
                switch (playerState)
                {
                //Keep the dampness timer at max whilst inside a cloud
                case PLAYER_STATE.PCS_WET:
                    if (dampnessTimer != null)
                    {
                        dampnessTimer.ResetTimer();
                    }
                    break;

                case PLAYER_STATE.PCS_NORMAL:
                case PLAYER_STATE.PCS_POWEREDUP:
                    break;
                }
            }
        }
Example #3
0
        public bool Collided(PhysicalObject other)
        {
            //Check the other object can collide with this one
            bool ignoreOther = true;

            for (int i = 0; i < collidableTypes.Count; ++i)
            {
                if (collidableTypes[i].IsInstanceOfType(other))
                {
                    ignoreOther = false;
                }
            }

            if (ignoreOther)
            {
                return(false);
            }

            return(Collided(other.position, other.dimensions));
        }
Example #4
0
        //Called when a new collision occurs
        public override void ReactToCollisionEntry(PhysicalObject other)
        {
            //TODO: Look into IDictionary and the Visitor pattern as possible alternatives to these if/else statements
            if (other is Projectile)
            {
                switch (playerState)
                {
                case PLAYER_STATE.PCS_NORMAL:
                case PLAYER_STATE.PCS_WET:
                    AudioManager.Instance.PlayAudioClip(AudioManager.AUDIOCLIPS.PATHETIC);
                    Destroy();
                    break;

                case PLAYER_STATE.PCS_POWEREDUP:
                    AudioManager.Instance.PlayRandomPain();
                    SetState(PLAYER_STATE.PCS_NORMAL);
                    break;
                }
            }
            else if (other is Powerup)
            {
                SetState(PLAYER_STATE.PCS_POWEREDUP);
            }
            else if (other is Cloud)
            {
                switch (playerState)
                {
                case PLAYER_STATE.PCS_NORMAL:
                    AudioManager.Instance.PlayRandomPain();
                    SetState(PLAYER_STATE.PCS_WET);
                    break;

                case PLAYER_STATE.PCS_WET:
                    AudioManager.Instance.PlayRandomPain();
                    break;

                case PLAYER_STATE.PCS_POWEREDUP:
                    break;
                }
            }
        }
Example #5
0
 public CollisionDetection(PhysicalObject a, PhysicalObject b)
 {
     object1 = a;
     object2 = b;
 }
Example #6
0
 public override void ReactToCollision(PhysicalObject other)
 {
     Destroy();
 }
Example #7
0
 public virtual void ReactToCollisionExit(PhysicalObject other)
 {
 }
Example #8
0
 public void RemoveObject(PhysicalObject objToRemove)
 {
     allObjects.Remove(objToRemove);
 }
Example #9
0
 public void AddObject(PhysicalObject objToAdd)
 {
     allObjects.Add(objToAdd);
 }
Example #10
0
 public override void ReactToCollisionEntry(PhysicalObject other)
 {
     AudioManager.Instance.PlayAudioClip(AudioManager.AUDIOCLIPS.EXPLOSION);
     GraphicsManager.Instance.AddAnimation(new ExplosionAnimation(this.GetCentre()));
     Destroy();
 }