示例#1
0
        protected override void SpawnEntity()
        {
            var position = Game.GetRandomPosition();

            var foodBlob = new FoodBlob(Game, Physics, _stateTracker, position);

            Game.AddBlob(foodBlob);
        }
示例#2
0
文件: GameTests.cs 项目: kfazi/AgarIo
        public void ShouldRemoveFoodAndReturnItsPosition()
        {
            var foodBlob = new FoodBlob(_game) { Position = new Vector(50, 50) };
            _game.AddBlob(foodBlob);

            var position = _game.RemoveFoodAndGetSpawnPosition();

            Assert.AreEqual(new Vector(50, 50), position);
        }
示例#3
0
        public void ShouldRemoveFoodAndReturnItsPosition()
        {
            var foodBlob = new FoodBlob(_game)
            {
                Position = new Vector(50, 50)
            };

            _game.AddBlob(foodBlob);

            var position = _game.RemoveFoodAndGetSpawnPosition();

            Assert.AreEqual(new Vector(50, 50), position);
        }
示例#4
0
    /**
     * function that handles spawning the food blob
     */
    private void SpawnBlob()
    {
        // instantiate a blob
        GameObject blob = (GameObject)Instantiate(SpawnType, SpawnPoint, Quaternion.identity);

        // add an itween path to the blob

        path = blob.GetComponent <FollowITweenPath>();
        path.nutrientSpeed = speed;                                     // set the food blob's speed on the path

        blobScript = blob.GetComponent <FoodBlob>();                    // get the script on the foodblob
        // call the function to generateenzymes on the blob
        blobScript.GenerateEnzymes(minNutrients, maxNutrients, availableColors);
    }