BlueGit

blue-star ggj-2020

Files

ggj-2020 / Assets / GAME / Scripts / Components / FlipSwitch.cs

FlipSwitch.cs

Jam end
timfa Tim Falken · pushed by timfa · 6 years ago
f9387e84 History
FlipSwitch.cs 570 B Download Raw
1using System.Collections;
2using System.Collections.Generic;
3using UnityEngine;
4
5public class FlipSwitch : Connectable
6{
7 [SerializeField] private Transform flipper;
8 [SerializeField] private float offRotation, onRotation;
9 public bool IsFlipped { get; private set; }
10
11 public override void Activate()
12 {
13 base.Activate();
14
15 SFXSpawner.StartSFX(SFXSpawner.Sounds.Click, transform.position);
16
17 IsFlipped = !IsFlipped;
18
19 flipper.transform.localRotation = Quaternion.Euler(IsFlipped ? onRotation : offRotation, 90, 90);
20 }
21}