Global Game Jam 2021
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

65 lines
1.5 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ControllerBase : MonoBehaviour
{
public CharacterController characterController;
public float speed = 6f;
public float sensitivity = 10f;
public GameObject body;
public GameObject testChild;
public YeetController yeetController;
void Start()
{
}
// Update is called once per frame
void Update()
{
Move();
//Rotate();
if(Input.GetButtonDown("Fire1"))
{
yeetController.parent = body;
switch(yeetController.yeetState)
{
case YeetController.YeetState.Unheld:
yeetController.Hold(testChild);
// Grab nearest baby
break;
case YeetController.YeetState.Held:
yeetController.Yeet();
// Yeet baby
break;
case YeetController.YeetState.Yeeting:
// Cooldown?
break;
}
}
}
void Move()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
Vector3 move = transform.forward * vertical + transform.right * horizontal;
characterController.Move(speed * Time.deltaTime * move);
}
void Rotate()
{
float horizontal = Input.GetAxis("Mouse Y");
body.transform.Rotate(0, horizontal * sensitivity, 0);
}
}