protected virtual void Start() { LastFiring = System.DateTime.Now; Pile cartridge_requirements = GetCartridgeRequirements(); Hoarder.Capacity.PutIn(cartridge_requirements * MagazineSize); ammunition_request = Unit.Team.Stock.MakeRequest(cartridge_requirements / Cooldown); }
void Update() { Physical.FrictionCoefficient_Perpendicular = FrictionCoefficient_Skid; Physical.FrictionCoefficient_Parallel = Mathf.Lerp(FrictionCoefficient_Unbraked, FrictionCoefficient_Braked, BrakePercent); if (Task is MoveTask) { this.Start <SeekBehavior>().Target = (Task as MoveTask).Target; } else { this.Stop <SeekBehavior>(); } if (!Physical.IsTouchingTerrain) { return; } if (request == null) { request = Unit.Team.Stock.MakeRequest(Propellent * 0); } //Turn towards direction indicated Quaternion target_rotation = Quaternion.LookRotation(target_direction); float target_yaw = target_rotation.eulerAngles.y; Physical.Yaw = MathUtility.ZenoLerpAngle(Physical.Yaw, target_yaw, Time.deltaTime * TurningSpeed, MathUtility.DegreesToRadians(5)); float target_pitch = target_rotation.eulerAngles.x; Physical.Pitch = Mathf.LerpAngle(Physical.Pitch, target_pitch, Time.deltaTime * TurningSpeed); //Apply force in forward direction float speed = Physical.Velocity.Dot(Physical.Direction); Physical.Force += Mathf.Min(1, 0.999f - speed / TopSpeed) * request.Yield * (request.UsagePerSecond.Volume / Propellent.Volume) * Force * Physical.Direction.normalized; //Surface gripping if (Physical.IsTouchingTerrain) { Physical.Force += -20 * Scene.Main.World.Asteroid.GetSurfaceNormal(Physical.Position); } request.UsagePerSecond = Propellent * DrivePercent; }
void Update() { if (Unit.Task is BuildTask) { this.Start <BuildBehavior>().BuildTask = Unit.Task as BuildTask; } else { this.Stop <BuildBehavior>(); } if (Project != null && !Project.IsProject) { StopBuilding(); } NanolathingLineController.Line.gameObject.SetActive(IsProjectWithinReach); if (IsProjectWithinReach) { if (request == null) { request = Unit.Team.Stock.MakeRequest(Project.RequiredMaterials.Normalized() * Rate); } NanolathingLineController.NanolathingRate = Rate * request.Yield; NanolathingLineController.Target = Project.transform.position + new Vector3(0, 0.5f, 0); Project.Foundation.PutIn(request.Disbursement); } else if (request != null) { request.Revoke(); request = null; NanolathingLineController.NanolathingRate = 0; } }
protected override void Start() { base.Start(); request = Unit.Team.Stock.MakeRequest(); }