Steam lobby implemented
This commit is contained in:
@ -1,38 +1,32 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
[RequireComponent(typeof(Animator))]
|
||||
|
||||
public class IKControl_Robot : MonoBehaviour
|
||||
{
|
||||
public bool ikActive;
|
||||
public Transform rightHandObj;
|
||||
public Transform leftHandObj;
|
||||
public Transform lookObj;
|
||||
public Transform stepOnObj;
|
||||
public Transform stepOffObj;
|
||||
|
||||
protected Animator animator;
|
||||
|
||||
public bool ikActive = false;
|
||||
public Transform rightHandObj = null;
|
||||
public Transform leftHandObj = null;
|
||||
public Transform lookObj = null;
|
||||
public Transform stepOnObj = null;
|
||||
public Transform stepOffObj = null;
|
||||
|
||||
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
transform.Rotate(0, 90, 0);
|
||||
}
|
||||
|
||||
//a callback for calculating IK
|
||||
void OnAnimatorIK()
|
||||
private void OnAnimatorIK()
|
||||
{
|
||||
if (animator)
|
||||
{
|
||||
|
||||
//if the IK is active, set the position and rotation directly to the goal.
|
||||
if (ikActive)
|
||||
{
|
||||
|
||||
// Set the look target position, if one has been assigned
|
||||
if (lookObj != null)
|
||||
{
|
||||
@ -48,6 +42,7 @@ public class IKControl_Robot : MonoBehaviour
|
||||
animator.SetIKPosition(AvatarIKGoal.RightHand, rightHandObj.position);
|
||||
animator.SetIKRotation(AvatarIKGoal.RightHand, rightHandObj.rotation);
|
||||
}
|
||||
|
||||
if (leftHandObj != null)
|
||||
{
|
||||
animator.SetIKPositionWeight(AvatarIKGoal.LeftHand, 1);
|
||||
@ -55,22 +50,22 @@ public class IKControl_Robot : MonoBehaviour
|
||||
animator.SetIKPosition(AvatarIKGoal.LeftHand, leftHandObj.position);
|
||||
animator.SetIKRotation(AvatarIKGoal.LeftHand, leftHandObj.rotation);
|
||||
}
|
||||
if(stepOnObj != null)
|
||||
|
||||
if (stepOnObj != null)
|
||||
{
|
||||
animator.SetIKPositionWeight(AvatarIKGoal.LeftFoot, 1);
|
||||
animator.SetIKRotationWeight(AvatarIKGoal.LeftFoot, 1);
|
||||
animator.SetIKPosition(AvatarIKGoal.LeftFoot,stepOnObj.position);
|
||||
animator.SetIKRotation(AvatarIKGoal.LeftFoot,stepOnObj.rotation);
|
||||
|
||||
animator.SetIKPosition(AvatarIKGoal.LeftFoot, stepOnObj.position);
|
||||
animator.SetIKRotation(AvatarIKGoal.LeftFoot, stepOnObj.rotation);
|
||||
}
|
||||
if(stepOffObj!= null) {
|
||||
|
||||
if (stepOffObj != null)
|
||||
{
|
||||
animator.SetIKPositionWeight(AvatarIKGoal.RightFoot, 1);
|
||||
animator.SetIKRotationWeight(AvatarIKGoal.RightFoot, 1);
|
||||
animator.SetIKPosition(AvatarIKGoal.RightFoot, stepOffObj.position);
|
||||
animator.SetIKRotation(AvatarIKGoal.RightFoot, stepOffObj.rotation);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if the IK is not active, set the position and rotation of the hand and head back to the original position
|
||||
@ -87,8 +82,6 @@ public class IKControl_Robot : MonoBehaviour
|
||||
|
||||
animator.SetIKPositionWeight(AvatarIKGoal.RightFoot, 0);
|
||||
animator.SetIKRotationWeight(AvatarIKGoal.RightFoot, 0);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,24 +1,24 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
|
||||
public class RobotMouthAnimator : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private VisualEffect fireEffect;
|
||||
|
||||
[SerializeField] private Light fireLight;
|
||||
|
||||
private Animator anim;
|
||||
[SerializeField]
|
||||
private VisualEffect fireEffect;
|
||||
[SerializeField]
|
||||
private Light fireLight;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
anim = GetComponent<Animator>();
|
||||
fireLight.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Return))
|
||||
{
|
||||
@ -26,21 +26,19 @@ public class RobotMouthAnimator : MonoBehaviour
|
||||
if (anim.GetBool("FlapsOpen"))
|
||||
{
|
||||
StartCoroutine(WaitToFire());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fireEffect.Stop();
|
||||
fireLight.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator WaitToFire()
|
||||
{
|
||||
yield return new WaitForSeconds(1.5f);
|
||||
fireEffect.Play();
|
||||
fireLight.gameObject.SetActive(true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user