using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovment : MonoBehaviour
{
public float speed;
private Vector3 offset;
public int step = 9;
bool input = true;
public GameObject player;
public GameObject center;
public GameObject right;
public GameObject left;
void Update()
{
if (input == true){
if(Input.GetKey(KeyCode.RightArrow)){
StartCoroutine("moveRight");
input = false;
}
if(Input.GetKey(KeyCode.LeftArrow)){
StartCoroutine("moveleft");
input = false;
}
}
}
IEnumerator moveRight(){
for(int i = 0;i<(90/step);i++){
player.transform.RotateAround(right.transform.position,Vector3.back,step);
yield return new WaitForSeconds (speed);
}
center.transform.position = player.transform.position;
input = true;
}
IEnumerator moveleft(){
for(int i = 0;i<(90/step);i++){
player.transform.RotateAround(left.transform.position,Vector3.forward,step);
yield return new WaitForSeconds (speed);
}
center.transform.position = player.transform.position;
input= true;
}
}
