Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        Monolog.Init();

        currentTlen = maxTlen;
        death       = false;
        //anim.SetTrigger("Start");
        rb      = GetComponent <Rigidbody>();
        tekster = GetComponent <AudioSource>();
    }
Beispiel #2
0
 void Update()
 {
     tekstTimer += Time.deltaTime;
     if (tekstTimer > tekstMaxTime)
     {
         print("test");
         tekstTimer = 0;
         tekster.PlayOneShot(Monolog.GetRandom(Monolog.teksty));
     }
     //red.color = new Color (1, 0, 0, (maxTlen - currentTlen * 2) / maxTlen);
     if (death)
     {
         niepotrzebnyTimer += Time.unscaledDeltaTime;
         print(niepotrzebnyTimer);
         if (niepotrzebnyTimer >= animacjiCzas)
         {
             SceneManager.LoadScene("gra");
         }
     }
 }
Beispiel #3
0
 void OnTriggerEnter(Collider col)
 {
     if (col.CompareTag("Mina"))
     {
         var fajnyObject = Instantiate(fajnaMina, col.gameObject.transform.position, col.gameObject.transform.rotation);
         Destroy(col.gameObject);
         fajnyObject.GetComponent <AudioSource>().Play();
         RaycastHit[] hitInfo = Physics.SphereCastAll(fajnyObject.transform.position, 3.0f, Vector3.zero);
         foreach (var hit in hitInfo)
         {
             print(hit);
             fajnyObject.transform.GetChild(0).GetComponent <Rigidbody>().AddExplosionForce(10.0f, fajnyObject.transform.position, 5.0f);
         }
         tekster.PlayOneShot(Monolog.GetRandom(Monolog.smierci));
         death       = true;
         rb.velocity = new Vector3(0, 0, 0);
     }
     if (col.CompareTag("Siatka"))
     {
         tekster.PlayOneShot(Monolog.GetRandom(Monolog.siatki));
         currentTlen += reklamowka;
         Destroy(col.gameObject);
     }
 }
Beispiel #4
0
 private void Start()
 {
     mon = gm.GetComponent <Monolog>();
 }