void Awake() { // get component references masterComp = GetComponent <ShipMasterComp>(); track = GameObject.FindGameObjectWithTag("Track").GetComponent <GravityTrack>(); // init distance PID controller distanceController = new PID("distance controller"); distanceController.Kp = 300.0f; distanceController.Ki = 0.0f; distanceController.Kd = 50.0f; // init other data maxGrabDot = Mathf.Cos(maxGrabAngle * Mathf.Deg2Rad); restrictedGrabDot = Mathf.Cos(restrictedGrabAngle * Mathf.Deg2Rad); acceptableSwitchVal = Mathf.Cos(sharpSwapAngle * Mathf.Deg2Rad); defaultRailJumpTime = railJumpTimer.timerStart; railJumpPercent = 0.0f; noRailsInRange = false; // tag adjustor names grindLockers = new LogicLocker(); JUMP_SPEED_ADJUSTER_NAME += gameObject.GetInstanceID(); ATTACHED_ADJUSTER_NAME += gameObject.GetInstanceID(); // listen for server detach events EventServerGrindDetached += OnServerGrindDetached; // init grind commands clientGrindHistory = new GrindInputState[clientCmdHistorySize]; }
// Use this for initialization public virtual void Start() { // check to see if part of a gravity track track = transform.root.gameObject.GetComponent <GravityTrack>(); if (track != null) { // add to the track track.AddTrackSegment(this); } }