witches
This commit is contained in:
parent
ffb1f1caa1
commit
b21d392ff6
80 changed files with 2888 additions and 221 deletions
|
@ -0,0 +1,37 @@
|
|||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// Should be attached to the Arrow, not the skeleton
|
||||
/// </summary>
|
||||
[RequireComponent(typeof(Rigidbody))]
|
||||
public class ProjectileHandler : MonoBehaviour
|
||||
{
|
||||
[SerializeField] protected float _lifeSpan = 8.0f;
|
||||
protected Rigidbody RigidBody;
|
||||
protected bool FromTeamA;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
RigidBody = GetComponent<Rigidbody>();
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
// Destroy after _lifeSpan, in all case
|
||||
Destroy(this.gameObject, _lifeSpan);
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
// Align with speed
|
||||
if (RigidBody.linearVelocity.magnitude >= 1f) transform.forward = RigidBody.linearVelocity.normalized;
|
||||
}
|
||||
|
||||
public void LaunchProjectile(Vector3 baseSpeed, bool fromTeamA)
|
||||
{
|
||||
RigidBody.linearVelocity = baseSpeed;
|
||||
FromTeamA = fromTeamA;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue