-
Notifications
You must be signed in to change notification settings - Fork 0
/
AxisHandle.cs
52 lines (45 loc) · 1.23 KB
/
AxisHandle.cs
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
48
49
50
51
52
//
// Cuboid (http://github.com/arjonagelhout/cuboid)
// Copyright (c) 2023 Arjo Nagelhout
//
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Cuboid
{
public class AxisHandleData : HandleData
{
public Axis axis;
}
public class AxisHandle<T> : Handle<T> where T : AxisHandleData
{
[SerializeField] private MeshRenderer _meshRenderer;
/// <summary>
/// To be set by tool
/// </summary>
[System.NonSerialized] public Material DefaultMaterial;
/// <summary>
/// To be set by tool
/// </summary>
[System.NonSerialized] public Material HoveredMaterial;
/// <summary>
/// To be set by tool
/// </summary>
[System.NonSerialized] public Material PressedMaterial;
protected override void UpdateHoverPressedAppearance()
{
if (Pressed)
{
_meshRenderer.material = PressedMaterial;
}
else if (Hovered)
{
_meshRenderer.material = HoveredMaterial;
}
else
{
_meshRenderer.material = DefaultMaterial;
}
}
}
}