private void SnapToFloor(int floor) { this.floorIndex = Mathf.Clamp(floor, 0, (int)this.stops.Length - 1); ProceduralLiftStop proceduralLiftStop = this.stops[this.floorIndex]; this.cabin.transform.position = proceduralLiftStop.transform.position; if (base.isServer) { base.SetFlag(BaseEntity.Flags.Busy, false, false, true); base.SendNetworkUpdateImmediate(false); base.CancelInvoke(new Action(this.ResetLift)); } }
protected void Update() { if (this.floorIndex < 0 || this.floorIndex > (int)this.stops.Length - 1) { return; } ProceduralLiftStop proceduralLiftStop = this.stops[this.floorIndex]; if (this.cabin.transform.position == proceduralLiftStop.transform.position) { return; } this.cabin.transform.position = Vector3.MoveTowards(this.cabin.transform.position, proceduralLiftStop.transform.position, this.movementSpeed * UnityEngine.Time.deltaTime); if (this.cabin.transform.position == proceduralLiftStop.transform.position) { this.OnFinishedMoving(); } }
protected void Update() { if (this.floorIndex < 0 || this.floorIndex > this.stops.Length - 1) { return; } ProceduralLiftStop stop = this.stops[this.floorIndex]; if (Vector3.op_Equality(((Component)this.cabin).get_transform().get_position(), ((Component)stop).get_transform().get_position())) { return; } ((Component)this.cabin).get_transform().set_position(Vector3.MoveTowards(((Component)this.cabin).get_transform().get_position(), ((Component)stop).get_transform().get_position(), this.movementSpeed * Time.get_deltaTime())); if (!Vector3.op_Equality(((Component)this.cabin).get_transform().get_position(), ((Component)stop).get_transform().get_position())) { return; } this.OnFinishedMoving(); }