示例#1
0
        public void UpdateEfficiency(float deltaTime, IBosServiceCollection services)
        {
            IManagerService service = services.ManagerService;

            if (generatorData.Type == GeneratorType.Normal && services.PlanetService.IsMoonOpened)
            {
                if (services.SecretaryService.IsLoaded == false)
                {
                    return;
                }

                //when efficiency dropped to minimum values than we stop fatig accumulation
                if (BosMath.Approximately(Efficiency(services), service.MinManagerEfficiency))
                {
                    fatigueValue = 0;
                    return;
                }



                double managerFatigueSpeed = service.GetManagerFatigueEfficiencySpeed(Id);
                double changeForOneReport  = Services.SecretaryService.GetEfficiencyChangeForOneReport(Id);
                double deltaFatig          = deltaTime * managerFatigueSpeed;
                fatigueValue += deltaFatig;
                double oldEfficiency = Efficiency(services);
                double removedTotal  = 0;
                LogFatigueState(new LogManagerEfficiencyData {
                    CurrentFatigue = fatigueValue, FatigueForReport = changeForOneReport, FatigueSpeed = managerFatigueSpeed, Id = Id
                });

                if (fatigueValue >= changeForOneReport)
                {
                    int loops = (int)(fatigueValue / changeForOneReport);
                    removedTotal  = loops * changeForOneReport;
                    fatigueValue -= Math.Abs(removedTotal);
                    services.SecretaryService.TryAddReports(Id, loops);
                }

                if (removedTotal > 0)
                {
                    var drop = new GameEvents.EfficiencyDrop {
                        Value   = -removedTotal,
                        Manager = this
                    };

                    GameEvents.EfficiencyDropObservable.OnNext(drop);
                    GameEvents.OnEfficiencyDrop(drop);
                }
            }
        }
示例#2
0
        public static BezierData GetBizerQuadData(
            IPositionObject target,
            Vector2 start, Vector2 end, float interval,
            System.Action <GameObject> onComplete = null,
            float linearFactor = 0.25f, float orthoFactor = 0.25f)
        {
            Vector2 midPoint = BosMath.ControlPoint(start, end, linearFactor, orthoFactor, 1);

            Vector3[] points = new Vector3[] {
                start,
                midPoint,
                end
            };
            return(new BezierData()
            {
                Target = target,
                Interval = interval,
                OnComplete = onComplete,
                Points = points,
                Type = BezierType.Quadratic
            });
        }