You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Feel/NiceVibrations/Demo/_Common/Scripts/SoundSwitch.cs

35 lines
838 B
C#

1 month ago
// Copyright (c) Meta Platforms, Inc. and affiliates.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Lofelt.NiceVibrations
{
public class SoundSwitch : MonoBehaviour
{
public V2DemoManager DemoManager;
protected MMSwitch _switch;
protected virtual void Awake()
{
_switch = this.gameObject.GetComponent<MMSwitch>();
}
protected virtual void OnEnable()
{
if (DemoManager.SoundActive)
{
_switch.CurrentSwitchState = MMSwitch.SwitchStates.On;
_switch.InitializeState();
}
else
{
_switch.CurrentSwitchState = MMSwitch.SwitchStates.Off;
_switch.InitializeState();
}
}
}
}