Add amo and change baricade health
This commit is contained in:
@@ -36,8 +36,8 @@ public class BarricadeManager : MonoBehaviour
|
||||
|
||||
public void addPlank()
|
||||
{
|
||||
if (health < (barricadePlanks.Count * 10)) {
|
||||
health += 10;
|
||||
if (health < (barricadePlanks.Count * 50)) {
|
||||
health += 50;
|
||||
offMeshLink.enabled = false;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class BarricadeManager : MonoBehaviour
|
||||
{
|
||||
for (int i = 0; i < barricadePlanks.Count; i++)
|
||||
{
|
||||
if (i < (health / 10)) {
|
||||
if (i < (health / 50)) {
|
||||
barricadePlanks[i].SetActive(true);
|
||||
}
|
||||
else
|
||||
|
@@ -25,6 +25,10 @@ public class BlockManager : MonoBehaviour
|
||||
{
|
||||
healthTime = healthRate;
|
||||
}
|
||||
else if (blockType == BlockType.Ammo)
|
||||
{
|
||||
healthTime = healthRate;
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -38,6 +42,14 @@ public class BlockManager : MonoBehaviour
|
||||
healthTime = healthRate + Time.time;
|
||||
}
|
||||
}
|
||||
else if (blockType == BlockType.Ammo)
|
||||
{
|
||||
if (health < 100 && healthTime < Time.time)
|
||||
{
|
||||
health += 10;
|
||||
healthTime = healthRate + Time.time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Action()
|
||||
@@ -68,5 +80,13 @@ public class BlockManager : MonoBehaviour
|
||||
player.barricadeMaterials += (player.barricadeMaterials <= 40 ? 10 : (50 - player.barricadeMaterials));
|
||||
}
|
||||
}
|
||||
else if (blockType == BlockType.Ammo)
|
||||
{
|
||||
if (health > 0 && player.ammo < 50)
|
||||
{
|
||||
health -= 10;
|
||||
player.ammo += (player.ammo <= 40 ? 10 : (50 - player.ammo));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,8 @@ public class PlayerManager : MonoBehaviour
|
||||
private bool run = false;
|
||||
private Camera playerCamera;
|
||||
private Rigidbody rigidBody;
|
||||
public int barricadeMaterials = 10;
|
||||
public int barricadeMaterials = 50;
|
||||
public int ammo = 50;
|
||||
public List<GameObject> weaponList = new List<GameObject>();
|
||||
private GameObject createWeapon;
|
||||
public GuiManager guiManager;
|
||||
|
Reference in New Issue
Block a user