Exemplo n.º 1
0
        protected override void Initialize()
        {
            base.Initialize();

            var scene = _sceneManager.CreateScene("Test");

            var boidSprite = new Sprite(_assetManager.GetAsset <Texture2D>("boid"));

            // Create target
            var target = new GameObject();

            target.AddComponent <Rigidbody>();
            target.AddComponent <Target>();
            var sr = target.AddComponent <SpriteRenderer>();

            sr.sprite = boidSprite;
            sr.color  = Color.Green;
            scene.AddGameObject(target);

            // Create boids controller
            var flock = new GameObject();
            var f     = flock.AddComponent <Flock>();

            scene.AddGameObject(flock);

            // Create boids
            for (int i = 0; i < 25; i++)
            {
                var boid = new GameObject();
                boid.AddComponent <Rigidbody>();
                sr        = target.AddComponent <SpriteRenderer>();
                sr.sprite = boidSprite;
                var b = boid.AddComponent <Boid>();
                b.Target = target.Transform;
                f.AddBoid(b);
            }

            // Load the scene
            _sceneManager.LoadScene(scene);
        }
Exemplo n.º 2
0
 public Scene CreateScene(int serverId, int sceneId, ulong regionId = 0, SceneParam sceneParam = null)
 {
     return(mImpl.CreateScene(this, serverId, sceneId, regionId, sceneParam));
 }