private void Awake() { warriorRigid = GetComponent <Rigidbody>(); // Get appropriate component gravityCollectorPlanet = GameObject.FindGameObjectWithTag("Planet").GetComponent <GravityGenerator>(); // Find the tag "Planet" and get its component warriorRigid.useGravity = false; warriorRigid.constraints = RigidbodyConstraints.FreezeRotation; // Constrain the rotation. }
public void Init() { trans = transform; body = GetComponent <Rigidbody>(); origin = trans.position; if (gravity == null) { gravity = GetComponentInParent <GravityGenerator>(); } }
void Start() { // Initialize components gravityGenerator = gameObject.AddComponent <GravityGenerator>(); oxygenGenerator = gameObject.AddComponent <OxygenGenerator>(); warrantScanner = gameObject.AddComponent <WarrantScanner>(); integrityScanner = gameObject.AddComponent <IntegrityScanner>(); diagnosticsScanner = gameObject.AddComponent <DiagnosticsScanner>(); tractorBeam = gameObject.AddComponent <TractorBeam>(); }
public static void AddGenerator(GravityGenerator generator) { generators.Push(generator); }