Archival of the game.

This commit is contained in:
2022-08-25 20:08:32 +02:00
commit c6deb71ef0
128 changed files with 14832 additions and 0 deletions
@@ -0,0 +1,68 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AntivirusController : MonoBehaviour
{
[SerializeField] private float posY;
[SerializeField] private GameObject AVShot;
public float health;
public float maxHealth;
//Barra de Vida.
[SerializeField] private Image barraVida;
//Combate
[SerializeField] private float dañoBalas = 10;
private void Update()
{
Mov();
if (Input.GetMouseButtonDown(0))
{
Disparar();
}
SetHeathBar();
if (health <= 0)
{
GameObject gamesystem = GameObject.FindGameObjectWithTag("GameSystem");
gamesystem.GetComponent<GameSystem>().EndGame();
}
}
private void Mov()
{
Vector2 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
mousePos.x = Mathf.Clamp(mousePos.x, -8.2f, 8.2f);
this.transform.position = new Vector2(mousePos.x, posY);
}
public void Disparar()
{
Instantiate(AVShot, this.gameObject.transform.position, AVShot.transform.rotation);
}
private void SetHeathBar()
{
barraVida.fillAmount = health / maxHealth;
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("V-Shot"))
{
health = health - dañoBalas;
Destroy(collision.gameObject);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1cecaae6e2f4a724b8e96752d8936fac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,51 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DefensasSystem : MonoBehaviour
{
public float health;
public float maxHealth;
//Barra de Vida.
[SerializeField] private Image barraVida;
[SerializeField] private GameObject healthPanel;
//Combate
[SerializeField] private float dañoBalas = 10;
private void Update()
{
if(health != maxHealth)
{
healthPanel.gameObject.SetActive(true);
SetHealthBar();
}
if(health == 0)
{
healthPanel.gameObject.SetActive(false);
Destroy(this.gameObject);
}
}
private void SetHealthBar()
{
barraVida.fillAmount = health / maxHealth;
}
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.gameObject.CompareTag("V-Shot") || collision.gameObject.CompareTag("AV-Shot"))
{
health = health - dañoBalas;
Destroy(collision.gameObject);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1ddc977a2ebadff4ca43ba6b0b2e822b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MovimientoBalas : MonoBehaviour {
public float balaSpeed;
[SerializeField] private bool haveMov;
[SerializeField] private float maxYValue;
[SerializeField] private float minYValue;
void Update ()
{
if (haveMov)
{
BalaMove();
}
if(transform.position.y > maxYValue || transform.position.y < minYValue)
{
DestroyBala();
}
}
private void BalaMove()
{
transform.position = new Vector2(transform.position.x, transform.position.y + 1 * balaSpeed);
}
public void DestroyBala()
{
Destroy(this.gameObject);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 784b539d4d0d5b642b936ded02b23649
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,82 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class VirusController : MonoBehaviour
{
public float health;
public float maxHealth;
[SerializeField] private float dañoBalas = 10;
[SerializeField] private Image barraVida;
//Movimiento y disparo.
[SerializeField] private float speed;
[SerializeField] private float MinShotTime;
[SerializeField] private float MaxShotTime;
private Transform target;
[SerializeField] private GameObject VShot;
private bool isShot;
float time;
private void Start()
{
target = GameObject.FindGameObjectWithTag("AntiVirus").GetComponent<Transform>();
isShot = true;
Shot();
}
private void Update()
{
SetHealthBar();
if (health <= 0)
{
StopAllCoroutines();
GameObject gamesystem = GameObject.FindGameObjectWithTag("GameSystem");
gamesystem.GetComponent<GameSystem>().WinGame();
}
Vector2 AVPos = new Vector2(target.position.x, transform.position.y);
transform.position = Vector2.MoveTowards(transform.position, AVPos, speed * Time.deltaTime);
time = Random.Range(MinShotTime, MaxShotTime);
}
private void Shot()
{
StartCoroutine(Shoting());
}
IEnumerator Shoting()
{
while (isShot)
{
yield return new WaitForSeconds(time);
Vector3 virusPos = new Vector3(this.gameObject.transform.position.x, this.gameObject.transform.position.y, 0f);
Instantiate(VShot, virusPos, Quaternion.Euler(0,0,0));
}
}
private void SetHealthBar()
{
barraVida.fillAmount = health / maxHealth;
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("AV-Shot"))
{
Debug.Log("tocado");
health = health - dañoBalas;
Destroy(collision.gameObject);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0fba2422b514c6c4e9298802e554f60a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: