Documentation for the Unity C# Library
Loading...
Searching...
No Matches
SimpleInteractable.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using UnityEngine;
5
6namespace PixoVR.Event
7{
9 {
10 [ContextMenu("light ON")]
11 private void lightOn()
12 {
13 Interactive(true);
14 }
15
16 [ContextMenu("light OFF")]
17 private void lightOFF()
18 {
19 Interactive(false);
20 }
21
22 private void Awake()
23 {
24 if (correctModels.Length < 2)
25 {
26 Debug.LogError("simple one model", this);
27 }
28
29 Interactive(false);
30 }
31
32 public override void Interactive(bool state)
33 {
34 if (state)
35 {
36 if (IsBroken)
37 correctModels[1].SetActive(state);
38 else
39 {
40 correctModels[0].SetActive(state);
41 }
42 }
43 else
44 {
45 foreach (var item in correctModels)
46 {
47 item.SetActive(false);
48 }
49 }
50 }
51 }
52}
s Base class for interactable objects with which the step manager interacts. It also stores a set of ...
GameObject[] correctModels
[SerializeField]
override void Interactive(bool state)