void Start() { material = GetComponent <Renderer>( ).material; Assert.IsNotNull(material); mechBodyParts = GetComponent <MechBodyParts>(); impactStartPosition = transform.position; }
void Awake() { slopeWalker = GetComponent <SlopeWalker>(); slopeWalker.enabled = false; anim = GetComponentInChildren <Animator>(); Assert.IsNotNull(ui); Assert.IsNotNull(explosion); Assert.IsNotNull(audioEvent); ui.SetName(mechName); hp = GetComponent <HP>(); weaponManager = GetComponent <WeaponManager>(); mechRigidbody = GetComponent <Rigidbody2D>(); string sceneName = SceneManager.GetActiveScene().name; if (sceneName.Contains("Space")) { isAffectedByGravity = false; } if (sceneName.Contains("Base")) { canExplodeIn3D = false; } mechBodyParts = GetComponentInChildren <MechBodyParts>(); mechBodyParts.canExplodeIn3D = canExplodeIn3D; mechBodyParts.isAffectedByGravity = isAffectedByGravity; thrusterFuelCurrent = thrusterFuelMax; anim.enabled = false; }