Files
HCI_GazeLab/Assets/SpaceShooterIgor/Scripts/Weapons/WeaponData.cs
T

88 lines
2.8 KiB
C#

using System;
using UnityEngine;
namespace Spaceshooter.Weapons
{
public enum WeaponType
{
StarterBlaster,
RapidLaser,
HeavyPlasma
}
[System.Serializable]
public class WeaponData
{
public WeaponType type;
public string weaponName;
public float damage;
public float cooldown;
public float projectileSpeed;
public Vector3 projectileScale = new Vector3(0.3f, 0.3f, 0.3f);
public Color projectileColor = Color.cyan;
public int cost;
public bool isPurchased;
public WeaponData(WeaponType type, string name, float damage, float cooldown, float speed, Vector3 scale, Color color, int cost, bool isPurchased = false)
{
this.type = type;
this.weaponName = name;
this.damage = damage;
this.cooldown = cooldown;
this.projectileSpeed = speed;
this.projectileScale = scale;
this.projectileColor = color;
this.cost = cost;
this.isPurchased = isPurchased;
}
public static WeaponData CreateDefault(WeaponType type)
{
switch (type)
{
case WeaponType.StarterBlaster:
return new WeaponData(
WeaponType.StarterBlaster,
"Starter Blaster",
damage: 25f,
cooldown: 0.35f,
speed: 18f,
scale: new Vector3(0.3f, 0.3f, 0.6f),
color: new Color(0.2f, 0.8f, 1f),
cost: 0,
isPurchased: true
);
case WeaponType.RapidLaser:
return new WeaponData(
WeaponType.RapidLaser,
"Rapid Laser",
damage: 15f,
cooldown: 0.12f,
speed: 26f,
scale: new Vector3(0.18f, 0.18f, 0.9f),
color: new Color(0.2f, 1f, 0.4f),
cost: 30,
isPurchased: false
);
case WeaponType.HeavyPlasma:
return new WeaponData(
WeaponType.HeavyPlasma,
"Heavy Plasma",
damage: 75f,
cooldown: 0.8f,
speed: 14f,
scale: new Vector3(0.55f, 0.55f, 0.55f),
color: new Color(1f, 0.4f, 0.1f),
cost: 60,
isPurchased: false
);
default:
return null;
}
}
}
}