Commit 80efc979 by Naliwe GS

Gameplay fixes

parent 74e79f6e
...@@ -33,7 +33,8 @@ namespace Assets.Scripts ...@@ -33,7 +33,8 @@ namespace Assets.Scripts
var leftBorder = Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x; var leftBorder = Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x;
if (!(rightBorder > (size.x*mult) - 5)) return; if (!(rightBorder > (size.x*mult) - 5)) return;
BG = (GameObject) Instantiate(BG, new Vector3(size.x + tra.position.x - .5f, tra.position.y, 0), Quaternion.identity);
BG = (GameObject) Instantiate(BG, new Vector3(size.x + tra.position.x - .5f, tra.position.y, 2), Quaternion.identity);
tra = BG.GetComponent<Transform>(); tra = BG.GetComponent<Transform>();
mult++; mult++;
} }
......
...@@ -25,17 +25,22 @@ namespace Assets.Scripts ...@@ -25,17 +25,22 @@ namespace Assets.Scripts
var newPos = Camera.main.ScreenToWorldPoint(Input.mousePosition); var newPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
newPos.z = -1; newPos.z = -1;
_pos.position = Vector3.Lerp(_pos.position, newPos, 10 * Time.deltaTime); _pos.position = Vector3.Lerp(_pos.position, newPos, 10*Time.deltaTime);
if (IsBlinking) if (IsBlinking)
Blink(); Blink();
if (Battery < 12) if (Battery < 12)
{ {
PlayerPrefs.SetInt("highscore", Score); if (PlayerPrefs.GetInt("highscore") < Score)
PlayerPrefs.SetInt("highscore", Score);
SceneManager.LoadScene("GameOver"); SceneManager.LoadScene("GameOver");
} }
if (Progression == 25) if (Progression == 25)
{
if (PlayerPrefs.GetInt("highscore") < Score)
PlayerPrefs.SetInt("highscore", Score);
SceneManager.LoadScene("Win"); SceneManager.LoadScene("Win");
}
} }
public void Blink() public void Blink()
......
using UnityEngine; using System;
using UnityEngine;
using System.Collections; using System.Collections;
public class Spawner : MonoBehaviour public class Spawner : MonoBehaviour
...@@ -22,7 +23,7 @@ public class Spawner : MonoBehaviour ...@@ -22,7 +23,7 @@ public class Spawner : MonoBehaviour
_timer += Time.deltaTime; _timer += Time.deltaTime;
_rightBorder = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)).x + 2; _rightBorder = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)).x + 2;
if (_timer >= 2f) if (_timer >= Math.Max((2 / (Time.time / 10)), .5f))
{ {
Spawn(); Spawn();
_timer = 0f; _timer = 0f;
...@@ -35,9 +36,10 @@ public class Spawner : MonoBehaviour ...@@ -35,9 +36,10 @@ public class Spawner : MonoBehaviour
if (r < 20) if (r < 20)
Instantiate(StaticEnemy, new Vector3(_rightBorder, _rand.Next(1, 9), 0), Quaternion.identity); Instantiate(StaticEnemy, new Vector3(_rightBorder, _rand.Next(1, 9), 0), Quaternion.identity);
else if (r < 50) else if (r < 45)
Instantiate(BasicEnemy, new Vector3(_rightBorder, _rand.Next(1, 9), 0), Quaternion.identity);
else
Instantiate(Toluen, new Vector3(_rightBorder, _rand.Next(1, 9), 0), Quaternion.identity); Instantiate(Toluen, new Vector3(_rightBorder, _rand.Next(1, 9), 0), Quaternion.identity);
r = _rand.Next(100);
if (r < 50)
Instantiate(BasicEnemy, new Vector3(_rightBorder, _rand.Next(1, 9), 0), Quaternion.identity);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment