Exemple #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         Rigidbody rb = other.gameObject.GetComponent <Rigidbody>();
         //StopMomentum
         rb.velocity = Vector3.zero;
         //Trasfer to last checkpoint
         inGameUI inGui     = other.gameObject.GetComponent <inGameUI>();
         var      lastCheck = inGui.lastCheckPointTrasform;
         other.gameObject.transform.position = lastCheck;
     }
 }
Exemple #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.GetComponent <inGameUI>())
     {
         inGameUI iGU = other.GetComponent <inGameUI>();
         if (iGU.currentCheckPoint == checkPointIndex + 1 || iGU.currentCheckPoint == checkPointIndex - 1)
         {
             Vector3 center = rend.bounds.center;
             //Jos ajoneuvon indexi oli yksi suurempi tai pienempi
             iGU.currentCheckPoint = checkPointIndex;
             iGU.checkpointsPassed++;
             iGU.lastCheckPointTrasform = center;
             iGU.RankTheRaces();
         }
     }
 }
Exemple #3
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <inGameUI>())
        {
            //haetaan toisen pelaajan inGameUi
            inGameUI iGu = other.GetComponent <inGameUI>();

            //Jos pelaajan current checkpoint matchaa totalin kanssa
            if (iGu.currentCheckPoint == checkpointTotal)
            {
                // pelaahan inGameUI skriptissä aloitetaan LapCompleted();

                iGu.LapCompleted();
            }
        }
    }
Exemple #4
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.GetComponent <inGameUI>())
     {
         inGameUI      iGUI     = other.GetComponent <inGameUI>();
         PlayerItemUse instance = other.GetComponent <PlayerItemUse>();
         //Tarkastetaan onko alfa invisible, jos on niin pelaajalla ei asetta atm
         if (iGUI.pickupImg.color.a == 0)
         {
             //random numero joka päättää spriten ja sitä mukaan aseen
             //tämä siksi että voidaan infota pelaajalle mikä ase hänellä on
             var randNumber = Random.Range(0, folder.Length);
             iGUI.pickupImg.sprite    = folder[randNumber];
             instance.weaponindicator = randNumber;
             //asetetaan pickupimagen alpha näkyväksi
             iGUI.pickupImg.color = iGUI.alphaVisible;
             //itseselitteinen
             this.gameObject.SetActive(false);
             Invoke("cooldown", 4f);
         }
     }
 }
 void Awake()
 {
     _instance = this;
 }