-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAG_VTOL_Controller.cs
84 lines (63 loc) · 2.17 KB
/
AG_VTOL_Controller.cs
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
namespace AtlasStudio
{
[RequireComponent(typeof(AG_VTOL_Inputs))]
public class AG_VTOL_Controller : AG_Base_Rigidbody_Controller
{
#region Variables
[Header("VTOL Properties")]
public AG_VTOL_Engine engine = new AG_VTOL_Engine();
public AG_VTOL_Engine_Carrier carrier = new AG_VTOL_Engine_Carrier();
private AG_VTOL_Inputs input;
private AG_VTOL_Characteristics characteristics;
#endregion
#region Builtin Methods
public override void Start()
{
base.Start();
characteristics = GetComponent<AG_VTOL_Characteristics>();
}
#endregion
#region Custom Methods
protected override void HandlePhysics()
{
input = GetComponent<AG_VTOL_Inputs>();
if (input)
{
HandleEngines();
HandleCarrierRotation();
HandleCharacterisctics();
}
}
#endregion
#region VTOL Control Methods
protected virtual void HandleEngines()
{
if(engine)
{
rb.AddForce(engine.UpdateEngine(rb, input.StickyThrottle));
//transform.localRotation = Quaternion.Euler(input.StickyThrottle * 10f, 0f, 0f);
engine.CalculateAngleEngine();
}
}
protected virtual void HandleCharacterisctics()
{
if(characteristics)
{
characteristics.UpdateCharacteristics(rb, input, carrier, engine);
}
}
protected virtual void HandleCarrierRotation()
{
if(carrier)
{
carrier.UpdateCarrierRotation(input.StickyThrottle);
//Debug.Log("Handle Carrier");
}
}
#endregion
}
}