示例#1
0
        /// <summary>
        /// Creates and spawns a rock with a random speed & velocity
        /// </summary>
        private void SpawnRock()
        {
            Vector3 position = GetRandomRockPosition();
            Vector3 velocity = GetRandomRockVelocity(position);

            Rock rock = RockFactory.CreateNew();

            rock.Position = position;
            rock.Velocity = velocity;

            lastSpawnTime = FlatRedBall.Screens.ScreenManager.CurrentScreen.PauseAdjustedCurrentTime;
        }
示例#2
0
    private void Awake()
    {
        FoodController         = GameObject.Find("FoodController").GetComponent <FoodController>();
        DamageSystemController = GameObject.Find("DamageSystemController").GetComponent <DamageSystemController>();
        LifeSystemController   = GameObject.Find("LifeSystemController").GetComponent <LifeSystemController>();
        SoundController        = GameObject.Find("SoundController").GetComponent <SoundController>();
        GameController         = GameObject.Find("GameController").GetComponent <GameController>();
        MenuController         = GameObject.Find("MenuController").GetComponent <MenuController>();
        EnemyController        = GameObject.Find("EnemyController").GetComponent <EnemyController>();

        foodFactory          = GameObject.Find("FoodFactory").GetComponent <FoodFactory>();
        lifeFactory          = GameObject.Find("LifeFactory").GetComponent <LifeFactory>();
        trapFactory          = GameObject.Find("TrapFactory").GetComponent <TrapFactory>();
        energyCapsuleFactory = GameObject.Find("EnergyCapsuleFactory").GetComponent <EnergyCapsuleFactory>();
        rockFactory          = GameObject.Find("RockFactory").GetComponent <RockFactory>();
    }
        public void RockFactoryReceivesAndProcessesSingleRockItemIssuingNotificationOnCompletion()
        {
            var rockFactory = new RockFactory();

            rockFactory.RegisterMonitor(this);
            const double weight = 3;

            Console.WriteLine("Sending {0} item of weight {1} for processing", RockType.Granit, weight);
            Guid jobId = rockFactory.ProcessRock(RockType.Granit, weight);

            Console.WriteLine("Waiting for notifications.");
            WaitForNotfication();
            Console.WriteLine("Notifications received.");

            Console.WriteLine("Test complete");
        }
        public void ContianerIdAvailableAfterCompletionNotificationReceived()
        {
            var rockFactory = new RockFactory();

            rockFactory.RegisterMonitor(this);
            const double weight = 5.6;

            Console.WriteLine("Sending {0} item of weight {1} for processing", RockType.Granit, weight);
            Guid jobId = rockFactory.ProcessRock(RockType.Granit, weight);

            Console.WriteLine("Waiting for notifications.");
            WaitForNotfication();
            Console.WriteLine("Notifications received.");

            var containerId = rockFactory.PackageManager.GetContainerIdForJob(jobId);

            Assert.IsTrue(containerId != Guid.Empty, "Failed to retrieve contianer Id from Package Manager");
            Console.WriteLine("Test complete");
        }
示例#5
0
    void Awake()
    {
        Director director = Director.getInstance();

        director.setFPS(60);
        director.currentSceneController = this;

        patrolFactory = new PatrolFactory();
        rockFactory   = new RockFactory();
        patrolFactory.Awake();
        rockFactory.Awake();

        director.currentSceneController.LoadResources();
        status = Status.Gaming;


        //patrolList = new List<GameObject>();
        //patrolList = new List<GameObject>();
        //director.currentSceneController.LoadResources();
    }
        public void ProcessInformationAvailableAfterNotificationCompletionReceived()
        {
            var rockFactory = new RockFactory();

            rockFactory.RegisterMonitor(this);
            const double weight = 5.6;

            Console.WriteLine("Sending {0} item of weight {1} for processing", RockType.Granit, weight);
            Guid jobId = rockFactory.ProcessRock(RockType.Granit, weight);

            Console.WriteLine("Waiting for notifications.");
            WaitForNotfication();
            Console.WriteLine("Notifications received.");

            var rockjob = rockFactory.GetProcessJob(jobId);

            Assert.IsNotNull(rockjob, "Failed to retrieve Job object from factory");
            Assert.AreEqual(jobId, rockjob.JobId);
            Console.WriteLine("Test complete");
        }
示例#7
0
文件: Level.cs 项目: Juhlinus/Nez4Fun
        public override void initialize()
        {
            base.initialize();
            addRenderer(new DefaultRenderer());

            _rockManager = new RockFactory(this);

            // TimedEvent to create rocks and star every tot seconds
            _timedEvent           = new TimedEvent((Screen.width / Constants.ObstaclesSpeed) / 2);
            _timedEvent.Interval += _rockManager.CreateRocks;

            // Entities
            addEntity(EntityFactory.CreateEntity(EntityType.Background));
            addEntity(EntityFactory.CreateEntity(EntityType.Terrain));
            var player = (Player)addEntity(EntityFactory.CreateEntity(EntityType.Player));

            player.Score = (IScore)addEntity(EntityFactory.CreateEntity(EntityType.Score));
            addEntity(_timedEvent);

            // Scene components
            addSceneComponent <LevelController>();
        }