77 lines
1.4 KiB
Plaintext
77 lines
1.4 KiB
Plaintext
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PHomeFirer : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
protected float m_shootRate;
|
|
|
|
private PHomeWeaponBase m_weapon;
|
|
protected PHomeWeaponBase Weapon
|
|
{
|
|
get
|
|
{
|
|
if (m_weapon == null)
|
|
{
|
|
m_weapon = GetComponent<PHomeWeaponBase>();
|
|
}
|
|
|
|
return m_weapon;
|
|
}
|
|
}
|
|
|
|
public PHomeUnit Unit
|
|
{
|
|
get
|
|
{
|
|
return Weapon.Unit;
|
|
}
|
|
}
|
|
|
|
protected GameObject ProjectilePrefab
|
|
{
|
|
get
|
|
{
|
|
return Weapon.ProjectilePrefab;
|
|
}
|
|
}
|
|
|
|
protected Vector2 AimDirection
|
|
{
|
|
get
|
|
{
|
|
return Unit.AimDirection;
|
|
}
|
|
}
|
|
|
|
protected ShootData GetShootData()
|
|
{
|
|
return new ShootData()
|
|
{
|
|
Unit = Unit,
|
|
Weapon = Weapon,
|
|
|
|
StartPoint = transform.position,
|
|
};
|
|
}
|
|
|
|
protected void ShootProjectiles(ShootData baseData, int count = 1)
|
|
{
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
PHomeProjectile proj = PHomeGameMode.main.SpawnProjectile(Unit, baseData, ProjectilePrefab);
|
|
}
|
|
}
|
|
|
|
public virtual bool CanFire()
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
|
|
public virtual IEnumerator Fire(int count)
|
|
{
|
|
throw new System.NotImplementedException();
|
|
}
|
|
}
|