Пример #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Garbage"))
     {
         currentGarb = other.GetComponent <GarbageThrow>();
         if (currentGarb != null)
         {
             currentGarb.addWind();
         }
         Debug.Log("Enerted WindZone");
     }
 }
Пример #2
0
    void CreateBall()
    {
        if (currentGarb != null)
        {
            currentGarb.enable = false;
        }

        currentGarb = Instantiate(ball, ballSpawnPoint.transform.position, ballSpawnPoint.transform.rotation);
        currentGarb.transform.SetParent(ballSpawnPoint.transform);
        currentGarb.GetComponent <Rigidbody>().isKinematic = true;
        currentGarb.OnCollision       += CreateBall;
        currentGarb.OnSuccesesfullHit += AddScore;

        OnGarbageCreated();
    }