New Reward function and MovementController

This commit is contained in:
Tobi
2019-05-23 17:28:37 +02:00
parent 411338a35d
commit 221ffb54dc
5 changed files with 156 additions and 193 deletions
@@ -0,0 +1,45 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum MovementState { Stop, Forward, Right, Left }
[RequireComponent(typeof(CozmoMovement))]
public class CozmoMovementController : MonoBehaviour
{
[Tooltip("Current MovementState of the Robot. Change this to make the robot move.")]
public MovementState currentMovementState = MovementState.Stop;
private CozmoMovement movement; // Movement script of the robot
// Start is called before the first frame update
void Start()
{
movement = GetComponent<CozmoMovement>();
}
private void FixedUpdate()
{
switch (currentMovementState)
{
case MovementState.Stop:
movement.Move(0);
break;
case MovementState.Forward:
movement.Move(1);
break;
case MovementState.Right:
movement.Turn(1);
break;
case MovementState.Left:
movement.Turn(-1);
break;
default:
movement.Move(0);
throw new ArgumentException("No real Movementstate was given. Default 'Stop' was chosen.");
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d3ecda30187828846b48edbee97aebd7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: