Ejemplo n.º 1
0
        public override void Init()
        {
            base.Init();
            tank.SetUp();
            // Testing below
            tank2.SetUp();
            tank2.tankSpeed  = 2;
            tankAni.isActive = true;
            tankAni.images.Add($"{Files.dirImg}explosion2.png");
            tankAni.images.Add($"{Files.dirImg}explosion3.png");
            tankAni.AssignTextures();
            texture = tankAni.CurrentTexture();
            int gameCheck = string.Compare(Game.playerName, "");

            if (gameCheck == 0)
            {
                Game.playerName = "player";
            }
            tank.name      = Game.playerName;
            tank.nameColor = Color.BLUE;
            // Setting parallax up
            ParallaxData data = Parallax.LoadJson(LoadImagesLevel.parallaxImages);

            if (data.filePath == "")
            {
                data = Parallax.LoadJson(LoadImagesLevel.parallaxImages + "\\");
            }
            parallax.Init(data.filePath, data.offset, data.scale, data.startSpeed, data.increasedSpeed);
            ammoBox.Inits();
            tank.ammo = 1;
        }
Ejemplo n.º 2
0
        void InitSimulation(List <NeuralNetwork.NeuralNetwork> nets = null)
        {
            _birds.Clear();
            _generation += 1;
            UnityEngine.Random.InitState(_seed);
            _parallax.Init();

            for (int i = 0; i < _birdCount; i++)
            {
                GameObject bird = Instantiate(_birdPrefab);
                bird.transform.position = _startPos.position;
                Agents.BirdView view = bird.GetComponent <Agents.BirdView>();
                Agents.Bird     b    = view.bird;

                if (nets != null)
                {
                    b.Init(view, new BirdAIController(nets[i]), c =>
                    {
                        OnBirdDeath(b);
                    });
                }
                else
                {
                    b.Init(view, new BirdAIController(), c =>
                    {
                        OnBirdDeath(b);
                    });
                }

                _birds.Add(b);
            }
        }
Ejemplo n.º 3
0
        // Sets the new parallax background
        public void NewBackGround()
        {
            parallax = new Parallax();
            ParallaxData data = Parallax.LoadJson(LoadImagesLevel.parallaxImages);

            if (data.filePath == "")
            {
                data = Parallax.LoadJson(LoadImagesLevel.parallaxImages + "\\");
            }

            parallax.Init(data.filePath, data.offset, data.scale, data.startSpeed, data.increasedSpeed);
        }
Ejemplo n.º 4
0
        public override void Init()
        {
            base.Init();
            losePos = new Vector2((int)textboxPos.x + 100, (int)textboxPos.y / 2);
            textBox.Init();
            ParallaxData data = Parallax.LoadJson(LoadImagesLevel.parallaxImages);

            if (data.filePath == "")
            {
                data = Parallax.LoadJson(LoadImagesLevel.parallaxImages + "\\");
            }
            parallax.Init(data.filePath, data.offset, data.scale, data.startSpeed, data.increasedSpeed);
        }
Ejemplo n.º 5
0
        public override void Init()
        {
            base.Init();
            textBox.Init();
            // Setting stuff up for paralax
            ParallaxData data = Parallax.LoadJson(LoadImagesLevel.parallaxImages);

            if (data.filePath == "")
            {
                data = Parallax.LoadJson(LoadImagesLevel.parallaxImages + "\\");
            }
            parallax.Init(data.filePath, data.offset, data.scale, data.startSpeed, data.increasedSpeed);
        }