Aetheria/Assets/Scripts/Gameplay/Weapons/ChargeEffectManager.cs
Reinier Vens 2a0fe34611 Charged Weapons & Hitscan Weapons
Implemented two new weapon types and created the Railgun (which is both) and accompanying VFX
2021-01-30 01:02:11 +00:00

38 lines
No EOL
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChargeEffectManager : MonoBehaviour
{
public Prototype EffectPrototype;
private Dictionary<ChargedWeapon, WeaponChargeEffect> ActiveEffects = new Dictionary<ChargedWeapon, WeaponChargeEffect>();
public void StartCharging(ChargedWeapon weapon, EquippedItem item, EntityInstance source)
{
var effect = EffectPrototype.Instantiate<WeaponChargeEffect>();
var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y];
var barrel = source.GetBarrel(hp);
var t = effect.transform;
t.SetParent(barrel);
t.forward = barrel.forward;
t.position = barrel.position;
effect.Weapon = weapon;
ActiveEffects[weapon] = effect;
}
public void StopCharging(ChargedWeapon weapon)
{
ActiveEffects[weapon].StopCharging();
}
public void Charged(ChargedWeapon weapon)
{
ActiveEffects[weapon].Charged();
}
public void Failed(ChargedWeapon weapon)
{
ActiveEffects[weapon].Failed();
}
}