68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using Steamworks;
|
|
using UnityEngine;
|
|
|
|
public class SzopaHalloween : MonoBehaviour
|
|
{
|
|
public Animator zombieFish;
|
|
|
|
public Transform door;
|
|
|
|
public Animator szopaAnimator;
|
|
|
|
private bool isTrigger;
|
|
|
|
private bool isDone;
|
|
|
|
private Vector3 lastCameraLocation;
|
|
|
|
private void Start()
|
|
{
|
|
zombieFish.gameObject.SetActive(value: false);
|
|
szopaAnimator.GetComponent<Animator>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (isTrigger)
|
|
{
|
|
FScriptsHandler.Instance.m_PlayerMain.m_Camera.transform.LookAt(zombieFish.transform.position);
|
|
FScriptsHandler.Instance.m_PlayerMain.firstPersonController.frezzePosition = true;
|
|
FScriptsHandler.Instance.m_PlayerMain.firstPersonController.frezzeRotation = true;
|
|
}
|
|
if (Vector3.Distance(door.position, FScriptsHandler.Instance.m_PlayerMain.m_Camera.transform.position) < 4f)
|
|
{
|
|
szopaAnimator.SetBool("OpenDoor", value: true);
|
|
}
|
|
else
|
|
{
|
|
szopaAnimator.SetBool("OpenDoor", value: false);
|
|
}
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (!isDone && other.gameObject.layer == LayerMask.NameToLayer("Player") && !isTrigger)
|
|
{
|
|
Debug.Log("Player in zombie fish");
|
|
zombieFish.gameObject.SetActive(value: true);
|
|
zombieFish.GetComponent<AudioSource>().Play();
|
|
zombieFish.SetTrigger("Start");
|
|
isTrigger = true;
|
|
lastCameraLocation = FScriptsHandler.Instance.m_PlayerMain.m_Camera.transform.localEulerAngles;
|
|
Invoke("UnTrigger", 3f);
|
|
}
|
|
}
|
|
|
|
private void UnTrigger()
|
|
{
|
|
isTrigger = false;
|
|
isDone = true;
|
|
FScriptsHandler.Instance.m_PlayerMain.m_Camera.transform.localEulerAngles = lastCameraLocation;
|
|
FScriptsHandler.Instance.m_PlayerMain.firstPersonController.UnFrezzeLook();
|
|
if (SteamUserStats.GetAchievement("HEART_ATTACK", out var pbAchieved) && !pbAchieved && SteamUserStats.SetAchievement("HEART_ATTACK"))
|
|
{
|
|
SteamUserStats.StoreStats();
|
|
}
|
|
}
|
|
}
|