summaryrefslogtreecommitdiff
path: root/GameCode/CopyPlayerAim.cs
blob: 46f23007fd4f6a7e483f851e29d98912dca14e9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using UnityEngine;

public class CopyPlayerAim : MonoBehaviour
{
	public float spreadPerLevel;

	public float spread;

	private AttackLevel level;

	private void Start()
	{
		level = GetComponentInParent<AttackLevel>();
	}

	public void Go()
	{
		float num = Random.Range(0f - spread, spread);
		float num2 = 0f;
		if ((bool)level)
		{
			num2 = (float)level.attackLevel * spreadPerLevel;
		}
		num += Random.Range(0f - num2, num2);
		Holding component = base.transform.root.GetComponent<Holding>();
		if ((bool)component)
		{
			base.transform.rotation = component.holdable.GetComponentInChildren<ShootPos>().transform.rotation;
		}
		base.transform.Rotate(Vector3.Cross(Vector3.forward, base.transform.forward) * num);
	}
}