Newer
Older
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
53
54
55
56
57
58
59
using Spine.Unity;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SteveZuckt : MonoBehaviour
{
SkeletonAnimation skeletonAnimation;
string currentAnimationState = "<None>";
// Start is called before the first frame update
void Start()
{
skeletonAnimation = GetComponent<SkeletonAnimation>();
}
// Update is called once per frame
void Update()
{
// if (Input.GetMouseButtonDown(0))
//{
Debug.Log("Steve zuckt Mouse Down");
//Vector3 mousePos = Input.mousePosition;
//mousePos.z = 10;
//Vector3 screenPos = Camera.main.ScreenToWorldPoint(mousePos);
//RaycastHit2D hit = Physics2D.Raycast(screenPos, Vector2.zero);
//Vector2 point = Camera.main.ScreenToWorldPoint(Input.mousePosition);
//RaycastHit2D hit = Physics2D.Raycast(point, Vector2.zero, Mathf.Infinity, ~(1 << LayerMask.NameToLayer("MovementCatcher")));
//Debug.Log(hit.transform.gameObject.name);
//if (hit && hit.transform.gameObject.name.Equals("Krokodilbesitzer"))
if(this.GetComponent<Entity>().dialogueInitiated)
{
currentAnimationState = "SteveAnprechen";
skeletonAnimation.AnimationName = "SteveAnprechen";
Debug.Log("Das könnte funktionieren! "); //Clicked " + hit.transform.gameObject.name);
}
else
{
currentAnimationState = "<None>";
skeletonAnimation.AnimationName = "<None>";
Debug.Log("Das funktioniert so nicht! "); // Clicked " + hit.transform.gameObject.name);
}
// }
}
//void OnMouseDown()
//{
// skeletonAnimation.AnimationName = "SteveAnsprechen";
// //currentAnimationState = "animation";
// Debug.Log("HAllo, ich bin getriggered");
//}
}