Пример #1
0
    void OnTriggerStay(Collider other)
    {
        //Debug.Log("stay!");
        if (other.gameObject.tag == "concrete")
        {
            playerWalkingState = walkingState.concrete;
        }
        if (other.gameObject.tag == "gravel")
        {
            playerWalkingState = walkingState.gravel;
        }
        if (other.gameObject.tag == "water")
        {
            playerWalkingState = walkingState.water;

            speedfactor = 1f;
            speed       = 20;
        }
        if (other.gameObject.tag == "dirt")
        {
            playerWalkingState = walkingState.dirt;

            speedfactor = 1.5f;
            speed       = 50;
        }
        if (other.gameObject.tag == "Ground")
        {
            playerWalkingState = walkingState.Ground;
            speedfactor        = 1.5f;
            speed = 50;
        }
    }
Пример #2
0
 void OnTriggerExit(Collider other)
 {
     //Debug.Log("exit!");
     if (other.gameObject.tag == "gravel")
     {
         playerWalkingState = walkingState.Ground;
     }
     if (other.gameObject.tag == "water")
     {
         playerWalkingState = walkingState.Ground;
         speedfactor        = 1.5f;
         speed = 50;
     }
     if (other.gameObject.tag == "dirt")
     {
         playerWalkingState = walkingState.Ground;
     }
     if (other.gameObject.tag == "Ground")
     {
         playerWalkingState = walkingState.concrete;
     }
 }