예제 #1
0
        //AddCollider - This method will add a collidable object to the CollisionMgr's list of Collidables
        //It will take in an IEntity and check itself if the IEntity is a collidable and then store it in its list


        public void AddCollider(IEntity pEntity)
        {
            //create a temporary IEntity to store pEntity
            IEntity tempEnt = pEntity;

            //Check if tempEnt is an ICollidable

            if (tempEnt is ICollidable)
            {
                //this will retrive the ID of the tempEnt, so that it can be stored in the ICollideable
                int tempID = tempEnt.eID;

                //this casts the tempEnt as a ICollidable
                ICollidable newCollidable = (ICollidable)tempEnt;

                //this initializes the ICollidable
                newCollidable.Initialize(tempID);

                //the new Collidable is stored in the '_mCollidersArray'
                _mColliders.Add(newCollidable);


                //this checks if the newCollidable is a Rigid Collider
                if (newCollidable is IRigidCollide)
                {
                    IRigidCollide newRigid = (IRigidCollide)newCollidable;
                    //this adds it to the _rigidCollide list
                    _rigidColliders.Add(newRigid);
                }

                //thi checks if the new Collidable is a IPlayCollider
                if (newCollidable is IPlayCollide)
                {
                    //this casts new collideable as a Player collider
                    IPlayCollide newPlayCollide = (IPlayCollide)newCollidable;

                    //this adds it to the _playCollide list
                    _playCollide.Add(newPlayCollide);
                }

                //this checks if the new Collider is an instanc eof IPlayer
                if (newCollidable is IPlayer)
                {
                    //this cast the new collider as a IPlayer
                    IPlayer newPlayer = (IPlayer)newCollidable;

                    //this adds it to the player list
                    _mPlayers.Add(newPlayer);
                }
            }
        }
예제 #2
0
 public override void Collide(IPlayCollide pCollider)
 {
     //this method will be used when the May collides with specific objects, such as enemies or pickups
 }
예제 #3
0
 // a colliision method to be called when the Player collides with a PlayerColidable
 public abstract void Collide(IPlayCollide pCollider);