BlueGit

blue-star ggj-2020

Files

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

FlipSwitch.cs

09143ea9 History
FlipSwitch.cs 495 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 IsFlipped = !IsFlipped;
16
17 flipper.transform.localRotation = Quaternion.Euler(IsFlipped ? onRotation : offRotation, 90, 90);
18 }
19}