GlobalGameJame/Assets/Scripts/WeaponManager.cs
2020-02-01 00:53:03 +01:00

48 lines
1022 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WeaponManager : MonoBehaviour
{
public enum WeaponType { None, Shoot, Meele };
public WeaponType weaponType = WeaponType.None;
public float weaponRange = 1;
public ParticleSystem particleShoot;
public float damage = 0;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void Attack()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, weaponRange))
{
}
if (weaponType == WeaponType.Shoot)
{
if (particleShoot != null && !particleShoot.isPlaying)
{
particleShoot.Stop();
particleShoot.Play();
}
}
else if (weaponType == WeaponType.Meele)
{
}
}
}