|
|
@ -0,0 +1,65 @@ |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |