Hi,
At 3.52 the code looks like this:
public class Player : MonoBehaviour
[SerializeField] IGun activeGun = null;
void Update()
If (Input.GetKeyDown(KeyCode.Space))
{
FireWeapon();
}
void FireWeapon()
{
activeGun.Fire();
}
At 4:07, it turns into this, with no explanation:
public class Player : MonoBehaviour
[SerializeField] MonoBehaviour activeGun = null;
void Update()
if (Input.GetKeyDown(KeyCode.Space))
{
FireWeapon();
}
void FireWeapon()
{
if (activeGun is IGun)
{
(activeGun as IGun).Fire();
}
}
Does anybody know why this happens? Thanks.