Ejemplo n.º 1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.TryGetComponent <Wall>(out Wall wall))
     {
         CollisionToDestroy--;
         if (CollisionToDestroy <= 0)
         {
             BallDestroyer.DestroyBall(gameObject);
         }
     }
 }
Ejemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     entitiesContainer = transform.Find("Entities").gameObject;
     propsContainer    = transform.Find("Props").gameObject;
     avatar            = entitiesContainer.transform.Find("Avatar").GetComponent <Avatar>();
     lightSwitch       = propsContainer.transform.Find("LightSwitch").GetComponent <LightSwitch>();
     door.Add(propsContainer.transform.Find("Doors").Find("DoorLeft").GetComponent <Door>());
     door.Add(propsContainer.transform.Find("Doors").Find("DoorRight").GetComponent <Door>());
     ballSpawner   = propsContainer.transform.Find("BallSpawner").GetComponent <BallSpawner>();
     ballDestroyer = propsContainer.transform.Find("BallDestroyer").GetComponent <BallDestroyer>();
     LeanTween.init(800);
     avatar.transform.position = Vector3.zero;
 }
Ejemplo n.º 3
0
    private void OnCollisionEnter(Collision other)
    {
        BallDestroyer ballDestroyer = other.gameObject.GetComponent <BallDestroyer>();

        if (ballDestroyer != null)
        {
            GameController.instance.EndGame();
        }

        PlatformHit platformHit = other.gameObject.GetComponent <PlatformHit>();

        if (platformHit != null)
        {
            GameController.instance.GetAudioController().Play(AudioControllerTrack.BallBump);
        }
    }
Ejemplo n.º 4
0
    IEnumerator CheckLifeTime()
    {
        yield return(new WaitForSeconds(LifeTime));

        BallDestroyer.DestroyBall(gameObject);
    }