public void AddInputListener(IEntity pEntity) { //Create a temporary IEntity that stores pEntity IEntity tempEnt = pEntity; //Check if tempEnt is an IInputListener if (tempEnt is IInputListener) { //This retrieves the Id of temp ent to be stored. int tempID = tempEnt.eID; //Casts tempent as an IInputlistener IInputListener newInput = (IInputListener)tempEnt; //Intialise Input newInput.Initialize(tempID); //the new input gets placed inside an array _mInputs _mInputs.Add(newInput); if (newInput is IPlayerControler) { //cast the Input as anew IPlayerCollider IPlayerControler newPlayer = (IPlayerControler)newInput; //ad this to the Iplayer List _mPlayers.Add(newPlayer); } } }