-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPressCubePuzzle.cs
More file actions
47 lines (42 loc) · 1.06 KB
/
PressCubePuzzle.cs
File metadata and controls
47 lines (42 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PressCubePuzzle : MonoBehaviour
{
public GameObject[] activeObjects;
public GameObject[] deactiveObjects;
// Update is called once per frame
void Update()
{
if (AllObjectsActive() && AllObjectsDeactive())
{
this.gameObject.SetActive(false);
}
}
bool AllObjectsActive()
{
foreach (GameObject obj in activeObjects)
{
if (obj != null && !obj.activeSelf)
{
// En az bir obje aktif deðilse false döndür
return false;
}
}
// Tüm objeler aktifse true döndür
return true;
}
bool AllObjectsDeactive()
{
foreach (GameObject obj in deactiveObjects)
{
if (obj != null && obj.activeSelf)
{
// En az bir obje aktifse false
return false;
}
}
// Tüm objeler aktif deðilse true döndür
return true;
}
}