added crosshair, worked on controls, fixed locals
This commit is contained in:
@@ -10,8 +10,6 @@ namespace Assets.Scripts.Player
|
||||
{
|
||||
UIHandler uihandler;
|
||||
GameObject interact;
|
||||
public float mouseSpeed = 10f; //the sensibility
|
||||
public float controllerSpeed = 1f; //the sensibility
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@@ -45,24 +43,10 @@ namespace Assets.Scripts.Player
|
||||
return null;
|
||||
}
|
||||
|
||||
public void lookAround(Vector2 view, bool isController)
|
||||
public void lookAround(Vector2 view, float speed)
|
||||
{
|
||||
GameObject target = GameObject.Find("targetLooking");
|
||||
if (isController)
|
||||
{
|
||||
target.transform.localPosition = target.transform.localPosition + new Vector3(view.x,view.y,0) * controllerSpeed * Time.deltaTime;
|
||||
}
|
||||
else
|
||||
{
|
||||
target.transform.localPosition = target.transform.localPosition + new Vector3(view.x,view.y,0) * mouseSpeed * Time.deltaTime;
|
||||
}
|
||||
|
||||
if(target.transform.localPosition.x >= 3){
|
||||
target.transform.localPosition = new Vector3(3f,target.transform.localPosition.y,target.transform.localPosition.z);
|
||||
}
|
||||
if(target.transform.localPosition.x <= -3){
|
||||
target.transform.localPosition = new Vector3(-3f,target.transform.localPosition.y,target.transform.localPosition.z);
|
||||
}
|
||||
target.transform.localPosition = target.transform.localPosition + new Vector3(0,view.y,0) * speed * Time.deltaTime;
|
||||
if(target.transform.localPosition.y >= 2){
|
||||
target.transform.localPosition = new Vector3(target.transform.localPosition.x,2f,target.transform.localPosition.z);
|
||||
}
|
||||
@@ -80,7 +64,7 @@ namespace Assets.Scripts.Player
|
||||
if (hit.collider.gameObject.tag.ToLower().Contains("object"))
|
||||
{
|
||||
string obj = hit.collider.gameObject.tag.Split(':')[1];
|
||||
if (hit.distance <= 3 && !obj.ToLower().Equals("house"))
|
||||
if (hit.distance <= 10 && !obj.ToLower().Equals("house"))
|
||||
{
|
||||
if (!uihandler.isPlayerInFight())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user