Skip to content
Snippets Groups Projects
SteveZuckt.cs 1.92 KiB
Newer Older
Meike Wienholt's avatar
Meike Wienholt committed
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");

    //}

}