Advertisement
felippemala

First C#

Sep 21st, 2019
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.27 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Points : MonoBehaviour {
  6.     static bool a1killValue = false;
  7.     static bool a2killValue = false;
  8.     static bool a3killValue = false;
  9.     static bool a4killValue = false;
  10.     static bool a5killValue = false;
  11.     static bool a6killValue = false;
  12.     static bool a7killValue = false;
  13.     // public int mOrreuN;
  14.     // Start is called before the first frame update
  15.     protected void SetukillValue() {
  16.         a1killValue = true;
  17.     }
  18.     protected void SetzkillValue() {
  19.         a2killValue = true;
  20.     }
  21.     protected void Setz2killValue() {
  22.         a3killValue = true;
  23.     }
  24.     protected void SetikillValue() {
  25.         a4killValue = true;
  26.     }
  27.     protected void SetpkillValue() {
  28.         a5killValue = true;
  29.     }
  30.     protected void SetakillValue() {
  31.         a6killValue = true;
  32.     }
  33.     protected void SetpkyllValue() {
  34.         a7killValue = true;
  35.     }
  36.     // Update is called once per frame
  37.     private void Update() {
  38.         if(a1killValue & a2killValue & a3killValue & a4killValue & a5killValue & a6killValue & a7killValue) {
  39.             Application.Quit();
  40.             //print("Fim de Jogo");
  41.         }
  42.     }
  43. }
  44.  
  45.  
  46.  
  47. //Filho
  48. using System.Collections;
  49. using System.Collections.Generic;
  50. using UnityEngine;
  51.  
  52.  
  53. public class KillU : Points {
  54.     private float pLaceX;
  55.     private float pLaceY;
  56.     private float pLace2Y;
  57.     private void OnTriggerEnter2D(Collider2D collision) {
  58.         //  toDie++;
  59.         SetukillValue();
  60.         //Cheking();
  61.         bool myBool = (Random.value > 0.5f);
  62.         if(collision.transform.CompareTag("Player"))
  63.             pLaceX = Random.Range(-10, 9.3f);
  64.         pLaceY = Random.Range(-5.33f, -1);
  65.         pLace2Y = Random.Range(5.37f, 2.5f);
  66.         gameObject.GetComponent<CircleCollider2D>().enabled = false;
  67.         if(myBool) {
  68.             collision.transform.position = new Vector2(pLaceX, pLace2Y);
  69.             // myBool = false;
  70.         } else {
  71.             collision.transform.position = new Vector2(pLaceX, pLaceY);
  72.             // myBool = true;
  73.         }
  74.         //collision.transform.position = spawnpoint.position;
  75.         //Ger and Set MorreuN Value
  76.        
  77.         //toDie = GetMorreu();
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement