blob: e139dde357f1189d739c7af445ea02404e168abf (
plain)
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
|
using UnityEngine;
public class Ladder : MonoBehaviour, Interactable, Hoverable
{
public Transform m_targetPos;
public string m_name = "Ladder";
public float m_useDistance = 2f;
public bool Interact(Humanoid character, bool hold)
{
if (hold)
{
return false;
}
if (!InUseDistance(character))
{
return false;
}
character.transform.position = m_targetPos.position;
character.transform.rotation = m_targetPos.rotation;
character.SetLookDir(m_targetPos.forward);
return false;
}
public bool UseItem(Humanoid user, ItemDrop.ItemData item)
{
return false;
}
public string GetHoverText()
{
if (!InUseDistance(Player.m_localPlayer))
{
return Localization.instance.Localize("<color=grey>$piece_toofar</color>");
}
return Localization.instance.Localize(m_name + "\n[<color=yellow><b>$KEY_Use</b></color>] $piece_use");
}
public string GetHoverName()
{
return m_name;
}
private bool InUseDistance(Humanoid human)
{
return Vector3.Distance(human.transform.position, base.transform.position) < m_useDistance;
}
}
|