You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
LittleManComputer/LMC/Assets/Nigga.cs

91 lines
2.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RobotAnimation : MonoBehaviour
{
public GameObject Robot;
public Animator robotanimation;
public int turning, pending, type, timer;
public float angle, curang, lmao;
float calc(float desire)
{
lmao = desire;
if (Mathf.Abs(desire - curang) <= 180F) return desire - curang;
else return 360F - (desire - curang);
}
void point(float x, float z, int pend)
{
float radians = Mathf.Atan((Robot.transform.position.x - x) / (Robot.transform.position.z - z));
float angl = calc(radians * (180 / Mathf.PI)) / 100F;
turning = 100;
pending = 100 + pend;
angle = angl;
type = 0;
}
void palm(int pend)
{
pending = 1 + pend;
type = 1;
}
void palmnpoint(float x, float z, int pend)
{
float radians = Mathf.Atan((Robot.transform.position.x - x) / (Robot.transform.position.z - z));
float angl = calc(radians * (180 / Mathf.PI)) / 100F;
turning = 100;
pending = 100 + pend;
angle = angl;
type = 2;
}
void rest(int pend)
{
float angl = calc(0) / 100F;
turning = 100;
pending = 100 + pend;
angle = angl;
type = 3;
}
// Start is called before the first frame update
void Start()
{
robotanimation = GetComponent<Animator>();
point(24, 0, 0);
}
// Update is called once per frame
void Update()
{
timer++;
if (timer == 300) palm(0);
if (turning > 0)
{
turning--;
Robot.transform.Rotate(0, angle, 0, Space.Self);
curang += angle;
}
if (pending > 0)
{
pending--;
if (pending == 0)
{
if (type == 0) robotanimation.Play("Point");
else if (type == 1) robotanimation.Play("OpenPalm");
else if (type == 2) robotanimation.Play("OpenPalm&Point");
else if (type == 3)
{
robotanimation.Play("Rest");
pending = 30;
type = 4;
}
else if (type == 4) robotanimation.Play("Idle");
}
}
}
}