-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathPlayerRocketBoots.cs
52 lines (47 loc) · 2.24 KB
/
PlayerRocketBoots.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
using UnityEngine;
namespace AdvancedCompany
{
[LoadAssets]
public class PlayerRocketBoots : MonoBehaviour
{
public GameObject LeftRocket;
public GameObject RightRocket;
private ParticleSystem LeftParticles;
private ParticleSystem RightParticles;
private bool Initialized = false;
private static GameObject LeftRocketBootPrefab;
private static GameObject RightRocketBootPrefab;
public static void LoadAssets(AssetBundle assets)
{
LeftRocketBootPrefab = assets.LoadAsset<GameObject>("Assets/Prefabs/Objects/RocketBootsLeft.prefab");
RightRocketBootPrefab = assets.LoadAsset<GameObject>("Assets/Prefabs/Objects/RocketBootsRight.prefab");
}
public void Awake()
{
var spine = transform.Find("ScavengerModel").Find("metarig").Find("spine");
var leftHeel = spine.Find("thigh.L").Find("shin.L").Find("foot.L");
var rightHeel = spine.Find("thigh.R").Find("shin.R").Find("foot.R");
if (LeftRocket == null)
{
LeftRocket = GameObject.Instantiate(LeftRocketBootPrefab, leftHeel);
LeftRocket.transform.localPosition = new Vector3(-0.0786f, -0.0302f, 0.0056f);
LeftRocket.transform.localEulerAngles = new Vector3(-54.256f, -170.885f, 169.978f);
LeftRocket.transform.localScale = new Vector3(0.5319018f, 0.5319018f, 0.5319018f);
LeftParticles = LeftRocket.transform.Find("Particles").GetComponent<ParticleSystem>();
}
if (RightRocket == null)
{
RightRocket = GameObject.Instantiate(RightRocketBootPrefab, rightHeel);
RightRocket.transform.localPosition = new Vector3(0.0833f, -0.0401f, 0.0086f);
RightRocket.transform.localEulerAngles = new Vector3(-124.165f, 0.07899f, -0.55297f);
RightRocket.transform.localScale = new Vector3(0.5319018f, 0.5319018f, 0.5319018f);
RightParticles = RightRocket.transform.Find("Particles").GetComponent<ParticleSystem>();
}
}
public void PlayParticles()
{
LeftParticles.Play();
RightParticles.Play();
}
}
}