AVANCE 4
UPGRADE SYSTEM » Devlog
De igual modo comencé a trabajar en un "Weapon reader" que me ayudaría a la comunicación entre estos scripts. Y a separar un poco los comportamientos de unity.
Otra cosa que debe considerarse es que se buscaba que cada arma tuviera un comportamiento diferente. Por lo que a la pistola dos le agregue que tuviera cartuchos.
using System.Collections;
using System.Threading;
using UnityEngine;
public class PistolaDos : Arma
{
private int cartuchos = 2;
private int maxBullets = 15;
private float recargaTiempo = 5f;
private bool needReload = false;
private float lastShootTime;
public PistolaDos()
{
PlayerSpeed = 10;
BulletDamage = 15;
bullets = 15;
maxBullets = bullets;
shootDelay = 0.3f;
currentShootType = ShootType.Single;
}
private void TimeGun(float time)
{
time-= Time.deltaTime;
if(time <= 0)
{
if (cartuchos > 0)
{
bullets = maxBullets;
cartuchos--;
needReload = false;
}
}
}
public override void Shoot()
{
if (Time.time - lastShootTime >= shootDelay && bullets > 0)
{
bullets--;
lastShootTime = Time.time;
if (bullets <= 0)
needReload = true;
TimeGun(5);
}
}
}UPGRADE SYSTEM
| Status | In development |
| Author | lissethmte |
| Genre | Shooter |
Leave a comment
Log in with itch.io to leave a comment.