-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIceFloeClimb.cs
52 lines (40 loc) · 1.45 KB
/
IceFloeClimb.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
using UnityEngine;
namespace Seasons
{
public class IceFloeClimb : MonoBehaviour, Hoverable, Interactable
{
public float m_useDistance = 3f;
public float m_radius = 4f;
public bool Interact(Humanoid character, bool hold, bool alt)
{
if (hold)
return false;
if (!InUseDistance(character))
return false;
character.transform.position = Vector3.Lerp(character.transform.position, base.transform.position, 0.35f) + Vector3.up;
Physics.SyncTransforms();
return false;
}
public bool UseItem(Humanoid user, ItemDrop.ItemData item)
{
return false;
}
public string GetHoverText()
{
if (!InUseDistance(Player.m_localPlayer))
return "";
return Localization.instance.Localize("[<color=yellow><b>$KEY_Use</b></color>] $piece_use");
}
public string GetHoverName()
{
return "";
}
public bool InUseDistance(Humanoid human)
{
if (base.transform.position.y - human.transform.position.y < 0.5f)
return false;
float distance = Vector3.Distance(human.transform.position, base.transform.position) / Mathf.Max(base.transform.localScale.x, base.transform.localScale.z);
return m_radius < distance && distance < m_radius + m_useDistance;
}
}
}