fixed chest, improved ui, improved difficulty
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Assets.Scripts.Player
|
||||
UIHandler uihandler;
|
||||
GameObject player;
|
||||
Vector2 rotation = Vector2.zero;
|
||||
public float mouseSpeed = 1; //the sensibility
|
||||
public float mouseSpeed = 100; //the sensibility
|
||||
public float controllerSpeed = 0.01f; //the sensibility
|
||||
float xMaxLimit = 50.0f;
|
||||
float xMinLimit = -50.0f;
|
||||
@@ -22,14 +22,14 @@ namespace Assets.Scripts.Player
|
||||
uihandler = GameObject.Find("UIHandler").GetComponent<UIHandler>();
|
||||
player = gameObject.transform.parent.gameObject;
|
||||
interact = GameObject.Find("pnlInteract");
|
||||
interact.transform.localScale = new Vector3(0,0,0);
|
||||
interact.transform.localScale = new Vector3(0, 0, 0);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.position = new Vector3(transform.parent.transform.position.x, transform.position.y, transform.parent.transform.position.z);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
@@ -37,15 +37,19 @@ namespace Assets.Scripts.Player
|
||||
showInformation();
|
||||
}
|
||||
|
||||
public void lookAround(Vector2 view, bool isController){
|
||||
public void lookAround(Vector2 view, bool isController)
|
||||
{
|
||||
rotation.y += view.x;
|
||||
rotation.x += -view.y;
|
||||
rotation.x = Mathf.Clamp(rotation.x, xMinLimit, xMaxLimit);
|
||||
if(isController){
|
||||
transform.eulerAngles = (Vector2)rotation * controllerSpeed;
|
||||
//rotation.x = Mathf.Clamp(rotation.x, xMinLimit, xMaxLimit);
|
||||
if (isController)
|
||||
{
|
||||
transform.eulerAngles = rotation * (controllerSpeed * Time.deltaTime);
|
||||
}
|
||||
else{
|
||||
transform.eulerAngles = (Vector2)rotation * mouseSpeed;
|
||||
else
|
||||
{
|
||||
transform.eulerAngles = rotation * mouseSpeed;
|
||||
//TODO: Look at camera movement -> Not rly smooth. Weird drag
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,14 +69,18 @@ namespace Assets.Scripts.Player
|
||||
void showInformation()
|
||||
{
|
||||
RaycastHit hit;
|
||||
interact.transform.localScale = new Vector3(0,0,0);
|
||||
interact.transform.localScale = new Vector3(0, 0, 0);
|
||||
if (Physics.Raycast(transform.position, transform.forward, out hit, Mathf.Infinity))
|
||||
{
|
||||
if (hit.collider.gameObject.tag.ToLower().Contains("object"))
|
||||
{
|
||||
string obj = hit.collider.gameObject.tag.Split(':')[1];
|
||||
if(hit.distance <= 3 && !obj.ToLower().Equals("house")){
|
||||
interact.transform.localScale = new Vector3(1,1,1);
|
||||
if (hit.distance <= 3 && !obj.ToLower().Equals("house"))
|
||||
{
|
||||
if (!uihandler.isPlayerInFight())
|
||||
{
|
||||
interact.transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
}
|
||||
switch (obj.ToLower())
|
||||
{
|
||||
@@ -98,16 +106,20 @@ namespace Assets.Scripts.Player
|
||||
displayInformation(TextHandler.getText("chest"));
|
||||
break;
|
||||
case "ore":
|
||||
if(hit.collider.gameObject.name.ToLower().Contains("iron")){
|
||||
if (hit.collider.gameObject.name.ToLower().Contains("iron"))
|
||||
{
|
||||
displayInformation(TextHandler.translate("Iron ore"));
|
||||
}
|
||||
else if(hit.collider.gameObject.name.ToLower().Contains("gold")){
|
||||
else if (hit.collider.gameObject.name.ToLower().Contains("gold"))
|
||||
{
|
||||
displayInformation(TextHandler.translate("Gold ore"));
|
||||
}
|
||||
else if(hit.collider.gameObject.name.ToLower().Contains("copper")){
|
||||
else if (hit.collider.gameObject.name.ToLower().Contains("copper"))
|
||||
{
|
||||
displayInformation(TextHandler.translate("Copper ore"));
|
||||
}
|
||||
else if(hit.collider.gameObject.name.ToLower().Contains("tin")){
|
||||
else if (hit.collider.gameObject.name.ToLower().Contains("tin"))
|
||||
{
|
||||
displayInformation(TextHandler.translate("Tin ore"));
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user