コード例 #1
0
        private Services CreateAllSharedState(BouncyShooterOptions options)
        {
            var ss = new SharedState
            {
                ActorTypesCount = options.ActorTypesCount,
                BulletSpeed     = options.BulletSpeed,
                FireTimeout     = 1f / options.RateOfFire,
                ActorsCount     = options.ActorsCount,
                ActorSpeed      = options.ActorSpeed,
                BulletLifeTime  = options.BulletLifeTime,
                ActorRadius     = options.ActorRadius,
                BulletRadius    = options.BulletRadius
            };

            var allShared = new Services()
            {
                TimeService   = new TimeService(),
                ActorService  = new ActorService(),
                BulletService = new BulletService(),
                SharedState   = ss
            };

            if (options.IsRendering)
            {
                var bullet            = options.BulletPrefab;
                var bulletViewService = new BulletViewService()
                {
                    Pool = new Pool <Transform>(
                        () =>
                    {
                        var tr = Object.Instantiate(bullet).transform;
                        tr.gameObject.SetActive(false);
                        return(tr);
                    }, 2),
                    Views = new Dictionary <int, Transform>()
                };
                var actor = options.ShooterPrefab;

                var actorViewService = new ActorViewService()
                {
                    Pool = new Pool <Transform>(
                        () =>
                    {
                        var tr = Object.Instantiate(actor).transform;
                        tr.gameObject.SetActive(false);
                        return(tr);
                    }, 2),
                    Views = new Dictionary <int, Transform>()
                };

                allShared.ActorViewService  = actorViewService;
                allShared.BulletViewService = bulletViewService;
            }

            return(allShared);
        }
コード例 #2
0
        private SharedState CreateSharedState(BouncyShooterOptions options)
        {
            var ss = new SharedState
            {
                ActorTypesCount = options.ActorTypesCount,
                BulletSpeed     = options.BulletSpeed,
                FireTimeout     = 1f / options.RateOfFire,
                ActorsCount     = options.ActorsCount,
                ActorSpeed      = options.ActorSpeed,
                BulletLifeTime  = options.BulletLifeTime,
                ActorRadius     = options.ActorRadius,
                BulletRadius    = options.BulletRadius
            };

            return(ss);
        }
コード例 #3
0
 public EcsliteV1BouncyShooterBenchmark(BenchmarkOptions options)
 {
     _options = (BouncyShooterOptions)options;
 }
コード例 #4
0
 public LeoEcsResizeBouncyShooterBenchmark(BenchmarkOptions options)
 {
     _options     = (BouncyShooterOptions)options;
     _isRendering = this._options.IsRendering;
 }