Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class TriggerMineScript : MonoBehaviour
  6. {
  7. public int zmienna;
  8. private GameObject go; //trigger explosion to load on start at places where bomb is red
  9. // Start is called before the first frame update
  10. void Awake() {
  11. }
  12. void Start()
  13. {
  14. go = GameObject.FindWithTag("ExplosionAreaMineTrigger");
  15.  
  16. if (PlayerPrefs.GetInt(this.zmienna.ToString()) == 1) {
  17. this.GetComponent<Renderer>().material.SetColor("_Color", Color.red);
  18. Instantiate(go, transform.position, Quaternion.identity);
  19. }
  20. }
  21.  
  22. // Update is called once per frame
  23. void Update()
  24. {
  25.  
  26. }
  27.  
  28. void OnTriggerEnter(Collider col) {
  29. if (col.transform.name.Contains("Mine")) {
  30. Debug.Log("NO SPRAWDZONE @@@@@@@@@@@@@@@");
  31. PlayerPrefs.SetInt(zmienna.ToString(), 1);
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement