but I am stuck at the point of having it to detect the downward
What’s preventing you from checking the rest of the cases?
public enum EGroundTypes { None, Floor, SlopeDown, Downward, etc }
EGroundTypes m_EFloorVariable = EGroundTypes.Floor;
void OnTriggerEnter(Collider a_collider)
{
Debug.Log ("collided with " + a_collider.gameObject.name); // I think the name's better than tag here.
switch(m_EFloorVariable)
{
case EGroundTypes.Floor:
// do something
break;
case EGroundTypes.SlopeDown:
// do something
break;
case EGroundTypes.Downward:
// do something
break;
case EGroundTypes.etc:
// do something
break;
}
}
Looks like your private variable m_EFloorVariable is always set to EGroundTypes.Floor. What you may want to do instead is to make it a public variable so it gets exposed in Unity editor, then add your script to each ground object in the scene and set the ground type for each ground object right inside the editor.
class GroundScript {
...
//drag GroundScript onto each ground object in the scene
//then change "Ground Type" property right in the editor
public EGroundTypes groundType = EGroundTypes.None;
...
void OnCollisionEnter(Collider collider) {
switch (groundType) {
case EGroundTypes.Floor:
//action
break;
case EGroundTypes.SlopeDown:
//action
break;
...
}
}
}