Commit 80efc979 by Naliwe GS

Gameplay fixes

parent 74e79f6e
......@@ -33,7 +33,8 @@ namespace Assets.Scripts
var leftBorder = Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)).x;
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>();
mult++;
}
......
......@@ -25,17 +25,22 @@ namespace Assets.Scripts
var newPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
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)
Blink();
if (Battery < 12)
{
PlayerPrefs.SetInt("highscore", Score);
if (PlayerPrefs.GetInt("highscore") < Score)
PlayerPrefs.SetInt("highscore", Score);
SceneManager.LoadScene("GameOver");
}
if (Progression == 25)
{
if (PlayerPrefs.GetInt("highscore") < Score)
PlayerPrefs.SetInt("highscore", Score);
SceneManager.LoadScene("Win");
}
}
public void Blink()
......
using UnityEngine;
using System;
using UnityEngine;
using System.Collections;
public class Spawner : MonoBehaviour
......@@ -22,7 +23,7 @@ public class Spawner : MonoBehaviour
_timer += Time.deltaTime;
_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();
_timer = 0f;
......@@ -35,9 +36,10 @@ public class Spawner : MonoBehaviour
if (r < 20)
Instantiate(StaticEnemy, new Vector3(_rightBorder, _rand.Next(1, 9), 0), Quaternion.identity);
else if (r < 50)
Instantiate(BasicEnemy, new Vector3(_rightBorder, _rand.Next(1, 9), 0), Quaternion.identity);
else
else if (r < 45)
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