Exemplo n.º 1
0
    void OnTriggerEnter(Collider other)
    {
        if(other.gameObject.tag=="energy"){
            Destroy(other.gameObject);
            energy+=5000.0f;
        }
            else if(other.gameObject.tag=="terrain"){
                energy-=5.0f;
                showEnergyLoss=true;
                Invoke("disableShowEnergyLoss", 2);
                touchGround=true;
        }
            else if(other.gameObject.tag=="checkpoint"){
                touchGround=true;
                checkpoint cp = ((checkpoint)other.gameObject.GetComponent("checkpoint"));
                if(cp.id == (checkpointID+1) && cp.obstacles <= obstacles){
                        checkpointID++;
                        obstacles = 0;
                        showCheckpointReached = true;
                        Invoke("disableShowCheckpointReached", 2);
                        lastCheckpoint = other.gameObject;
                        energy+= ((checkpoint)other.gameObject.GetComponent("checkpoint")).energy;
            }
        }
            else if(other.gameObject.tag=="obstacle"){
                    obstacles++;
                    Destroy(other.gameObject.GetComponent("BoxCollider"));

                    showObstacletReached = true;
                    Invoke("disableShowObstacletReached", 2);
        }
            else if(other.gameObject.tag=="hurdle"){
                    cf = (crashForce)other.gameObject.GetComponent("crashForce");
                    energy-= cf.energyLoss;
                    Invoke("disableCrashForce", 1);
        }
            else if(other.gameObject.tag=="life"){
                    Destroy(other.gameObject);
                    lifes++;
        }

        //TODO: Steffi
        else if(other.gameObject.tag=="wabe"){
                    wabeColl=true;
                    wabe = other.gameObject;
        }
    }
Exemplo n.º 2
0
 void disableCrashForce()
 {
     cf = null;
 }