Ejemplo n.º 1
0
 void Start()
 {
     temp   = speed;
     player = GameObject.FindGameObjectWithTag("Player");
     lifes  = player.GetComponent <Lifes>();
     rb2d   = this.GetComponent <Rigidbody2D>();
 }
Ejemplo n.º 2
0
    public override void Create()
    {
        Lifes.Add(force);
        Lifes.Add(constrain);
        Forms.Add(verts);

        force._Create();
        constrain._Create();
        verts._Create();

        force.BindPrimaryForm("_VertBuffer", verts);
        force.BindForm("_SkeletonBuffer", skeleton);

        force.BindAttribute("_NumVertsPerHair", "numVertsPerHair", skeleton);
        force.BindAttribute("_NumHairs", "numHairs", skeleton);
        force.BindAttribute("_VertsPerVert", "vertsPerVert", verts);

        constrain.BindPrimaryForm("_VertBuffer", verts);
        constrain.BindForm("_SkeletonBuffer", skeleton);

        constrain.BindAttribute("_NumVertsPerHair", "numVertsPerHair", skeleton);
        constrain.BindAttribute("_NumHairs", "numHairs", skeleton);
        constrain.BindAttribute("_VertsPerVert", "vertsPerVert", verts);
        constrain.BindAttribute("_Length", "armLength", this);
    }
Ejemplo n.º 3
0
    // Use this for initialization
    public override void Create()
    {
        Lifes.Add(place);
        Lifes.Add(bodyTransfer);
        Forms.Add(skin.verts);
        Forms.Add(verts);
        Forms.Add(bodyVerts);
        Forms.Add(bodyTris);



        verts._Create(skin.verts);

        bodyVerts._Create(verts);
        bodyTris._Create(bodyVerts);



        place._Create();
        bodyTransfer._Create();

        place.BindPrimaryForm("_VertBuffer", verts);
        place.BindForm("_SkinnedBuffer", skin.verts);
        place.BindAttribute("_Whirlwind", "whirlwindState", this);
        place.BindAttribute("_WhirlwindSpeed", "whirlwindSpeed", this);

        bodyTransfer.BindAttribute("_CameraUp", "cameraUp", this);
        bodyTransfer.BindAttribute("_CameraLeft", "cameraLeft", this);
        bodyTransfer.BindAttribute("_Radius", "radius", this);


        bodyTransfer.BindPrimaryForm("_VertBuffer", bodyVerts);
        bodyTransfer.BindForm("_ParticleBuffer", verts);
    }
Ejemplo n.º 4
0
    public override void Create()
    {
        /*
         * All of this info should be visualizable!
         */

        Lifes.Add(FlowerTransfer);

        Forms.Add(FlowerVerts);
        Forms.Add(FlowerTriangles);


        FlowerTransfer._Create();
        FlowerVerts._Create();
        FlowerTriangles._Create();
        body._Create();



        FlowerTransfer.BindPrimaryForm("_VertBuffer", FlowerVerts);
        FlowerTransfer.BindForm("_HairBuffer", Hair);

        FlowerTransfer.BindAttribute("_NumVertsPerHair", "numVertsPerHair", Hair);
        FlowerTransfer.BindAttribute("_Size", "size", this);
    }
 // Start is called before the first frame update
 void Start()
 {
     stillInWater = false;
     player       = GameObject.FindGameObjectWithTag("Player");
     movement     = player.GetComponent <Movement>();
     lifes        = player.GetComponent <Lifes>();
 }
Ejemplo n.º 6
0
        private void Start()
        {
            enemyLifes   = new Lifes(EnemyLifes);
            currentEnemy = spawnRandomEnemy();

            MinigameManager.Events.OnDodged += HandleDodged;
        }
Ejemplo n.º 7
0
    private void Fire(Tile t)
    {
        RemoveActionStats();

        if (t.c_inTile != null)
        {
            Lifes c_life = t.c_inTile.GetComponent <Lifes>();

            if (c_action.damage > 0)
            {
                c_life.GetHit(-c_action.damage, true);
            }
            if (c_action.heal > 0)
            {
                c_life.GetHit(c_action.heal, false);
            }

            if (c_action.rallPm > 0)
            {
                c_life.GetComponent <CharacterMove>().RemoveMovement(c_action.rallPm);
            }

            GameObject tmp = Instantiate(c_action.projectile, t.c_inTile.transform.position, c_action.projectile.transform.rotation);

            MainManager.Instance.DestroyItem(tmp, 3);
        }
        if (!ActionIsPossbile())
        {
            ActionManager.Instance.CancelAllActions();
        }
    }
Ejemplo n.º 8
0
        /// <summary>
        /// Funkcja wywoływana przy ładowaniu okna
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormGame_Load(object sender, EventArgs e)
        {
            //Wyświetlenie Nicku, liczby punktów oraz żyć gracza
            textBoxNick.Text   = Nick;
            textBoxPoints.Text = Points.ToString();
            textBoxPoints.Refresh();
            textBoxLifes.Text = Lifes.ToString();
            textBoxLifes.Refresh();

            //Nowy obiekt meganegra gry
            ClassGameMenager game = new ClassGameMenager(this);

            //Deklaracja tablicy przechowującej mapę gry
            tile = new PictureBox[784];

            //Odczyt przycisków z klawiatury
            this.KeyPreview = true;
            this.KeyDown   += new KeyEventHandler(game.ReadKey);

            //Załadowanie mapy
            game.MapLoad();
            MapDisplay(game.Map);

            //Deklaracja nowego wątku
            void NewThread()
            {
                game.PacmanSpawn(Nick);
            }

            //Utworzenie nowego wątku
            Thread thread = new Thread(NewThread);

            //Rozpoczęcie wątku
            thread.Start();
        }
Ejemplo n.º 9
0
        private void Start()
        {
            gameManager = GetComponentInParent <MinigameManager2>();
            lifes       = new Lifes(Lifes);

            subscribeToEvents();
        }
Ejemplo n.º 10
0
 /// <summary>
 /// ги исцртува преостанатите животи на играчот.
 /// </summary>
 /// <param name="g"></param>
 public void DrawLifeAndKilledEM(Graphics g)
 {
     g.DrawString(Lifes.ToString() + "X", font, brush, 880, 10);
     g.DrawImage(Properties.Resources.life, 950, -20);
     g.DrawImage(Properties.Resources.EMIcon, 10, 50);
     lblEMKilled.Text = CounterKilledEvilMinions.ToString();
 }
Ejemplo n.º 11
0
        public void Draw(float fElapsed)
        {
            if (PlayerState == PlayerState.Dead)
            {
                return;
            }

            var effect = Position.X < 400 ? SpriteEffects.FlipHorizontally : SpriteEffects.None;

            Game.SpriteBatch.Draw(_playerTexture, Position, null, Color.White, 0.0f, _playerTexture.GetCenter(), DepthScale, effect, 0);

            Game.ShapeRenderer.DrawFilledRectangle((int)(Position.X - 20), (int)(Position.Y - (_playerTexture.Height / 2) * DepthScale - 8), 40, 8, Color.Black);
            var width = (int)(Energy / 100.0f * 40);
            var color = Energy >= 80 ? Color.Green : Energy >= 40 ? Color.Yellow : Color.Red;

            Game.ShapeRenderer.DrawFilledRectangle((int)(Position.X - 20), (int)(Position.Y - (_playerTexture.Height / 2) * DepthScale - 8), width, 8, color);

            Game.SpriteBatch.Draw(_tachotexture, new Vector2(0, 250), Color.White);
            Game.SpriteBatch.DrawString(_font, Lifes.ToString(), new Vector2(20, 320), Color.White);

            var size = _font.MeasureString(Points.ToString());

            Game.SpriteBatch.DrawString(_font, Points.ToString(), (new Vector2(120, 386) - new Vector2(size.X, 0)).SnapToPixels(), Color.White);

            //Game.ShapeRenderer.DrawRectangle(Bounds, Color.Orange);
        }
Ejemplo n.º 12
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        playerLives = player.GetComponent<Lifes>();
        playerContr = player.GetComponent<GirlController>();

        Invoke("StopLevel", timeToBoss);
    }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Player")
     {
         Lifes lifes = other.gameObject.GetComponent<Lifes>();
         lifes.addlife(-damage);
     }
 }
Ejemplo n.º 14
0
 void Update()
 {
     UpdateConstantData();
     Positions.SetGlobal();
     Lifes.SetGlobal();
     Collisions.SetGlobal();
     Polygons.UpdatePolygons(polygonColliders);
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Timer odpowiedzialny za odświeżanie wyświetlanych informacji
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void timer1_Tick(object sender, EventArgs e)
 {
     textBoxPoints.Text = Points.ToString();
     textBoxLifes.Text  = Lifes.ToString();
     textBoxPoints.Refresh();
     textBoxLifes.Refresh();
     tableLayoutPanelMap.Refresh();
 }
Ejemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        player      = GameObject.FindGameObjectWithTag("Player");
        playerLives = player.GetComponent <Lifes>();
        playerContr = player.GetComponent <GirlController>();

        Invoke("StopLevel", timeToBoss);
    }
 // Start is called before the first frame update
 void Start()
 {
     StartCoroutine(WaitSeconds(3));
     target      = GameObject.FindGameObjectWithTag("Player");
     lifes       = target.GetComponent <Lifes>();
     moveDir     = (target.transform.position - transform.position).normalized * speed;
     rb.velocity = new Vector2(moveDir.x, moveDir.y);
 }
Ejemplo n.º 18
0
 public void StartGame()
 {
     if (gameState != GameState.Game)
     {
         canvasAnimator.SetTrigger("StartGame");
         lifes       = FindObjectOfType <Lifes>();
         waveDisplay = FindObjectOfType <WaveDisplay>();
         paused      = false;
         gameState   = GameState.Game;
         StartCoroutine(GameCycle());
     }
 }
Ejemplo n.º 19
0
        public void AddParticle(Vector2[] positions, float life)
        {
            var l = new float[positions.Length];

            for (var i = 0; i < positions.Length; i++)
            {
                l[i] = life;
            }
            Velocities.Upload(header, new Vector2[positions.Length]);
            Positions.Upload(header, positions);
            Lifes.Upload(header, l);
            header = (header + positions.Length) % capacity;
        }
Ejemplo n.º 20
0
    private void Push(Tile t)
    {
        Tile t_dest = tmp_tileMovementPrediction;

        if (t.c_inTile != null)
        {
            Lifes c_life = t.c_inTile.GetComponent <Lifes>();
            c_life.PushTo(t_dest.transform.position);

            Fire(tmp_tileMovementPrediction);

            t.c_inTile = null;
        }
    }
Ejemplo n.º 21
0
    public override void Create()
    {
        Lifes.Add(smooth);
        Forms.Add(smoothed);

        smooth._Create();
        smoothed._Create();

        smooth.BindPrimaryForm("_VertBuffer", smoothed);
        smooth.BindForm("_SkeletonBuffer", hair);

        smooth.BindAttribute("_NumVertsPerHair", "numVertsPerHair", hair);
        smooth.BindAttribute("_NumHairs", "numHairs", hair);
        smooth.BindAttribute("_SmoothNumVertsPerHair", "numVertsPerHair", smoothed);
    }
Ejemplo n.º 22
0
 void FixedUpdate()
 {
     Constants.SetConstants(compute, Time.fixedDeltaTime);
     VelSimulation.Simulate();
     Broadphase.FindBand(2f * constants.radius);
     for (var i = 0; i < 4; i++)
     {
         ParticleSolver.Solve();
         WallSolver.Solve();
         Velocities.ClampMagnitude();
     }
     PosSimulation.Simulate();
     BoundsChecker.Check();
     Lifes.Simulate();
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Zaktualizowanie danych dotyczących ilości punktów i żyć gracza zaczerpniętych z innego wątku
 /// </summary>
 /// <param name="pacman"></param>
 public void UpdateData(ClassPlayer pacman)
 {
     if (this.InvokeRequired)
     {
         this.Invoke(new Action <ClassPlayer>(UpdateData), pacman);
     }
     else
     {
         Points             = pacman.Points;
         Lifes              = pacman.Lifes;
         textBoxPoints.Text = Points.ToString();
         textBoxPoints.Refresh();
         textBoxLifes.Text = Lifes.ToString();
         textBoxLifes.Refresh();
     }
 }
Ejemplo n.º 24
0
    // Use this for initialization
    public override void Create()
    {
        Lifes.Add(skin);
        Forms.Add(verts);
        Forms.Add(tris);
        Forms.Add(bones);

        skin._Create();

        verts._Create(verts);
        tris._Create(tris);
        bones._Create(bones);

        skin.BindPrimaryForm("_VertBuffer", verts);
        skin.BindForm("_BoneBuffer", bones);
    }
Ejemplo n.º 25
0
 void OnDestroy()
 {
     if (Positions != null)
     {
         Positions.Dispose();
     }
     if (Velocities != null)
     {
         Velocities.Dispose();
     }
     if (Lifes != null)
     {
         Lifes.Dispose();
     }
     if (Constants != null)
     {
         Constants.Dispose();
     }
     if (Walls != null)
     {
         Walls.Dispose();
     }
     if (VelSimulation != null)
     {
         VelSimulation.Dispose();
     }
     if (PosSimulation != null)
     {
         PosSimulation.Dispose();
     }
     if (Broadphase != null)
     {
         Broadphase.Dispose();
     }
     if (WallSolver != null)
     {
         WallSolver.Dispose();
     }
     if (ParticleSolver != null)
     {
         ParticleSolver.Dispose();
     }
     if (Combiner != null)
     {
         Combiner.Dispose();
     }
 }
Ejemplo n.º 26
0
 void OnDestroy()
 {
     if (Positions != null)
     {
         Positions.Dispose();
     }
     if (Velocities != null)
     {
         Velocities.Dispose();
     }
     if (Lifes != null)
     {
         Lifes.Dispose();
     }
     if (Constants != null)
     {
         Constants.Dispose();
     }
     if (Polygons != null)
     {
         Polygons.Dispose();
     }
     if (VelSimulation != null)
     {
         VelSimulation.Dispose();
     }
     if (PosSimulation != null)
     {
         PosSimulation.Dispose();
     }
     if (Collisions != null)
     {
         Collisions.Dispose();
     }
     if (PolygonSolver != null)
     {
         PolygonSolver.Dispose();
     }
     if (ParticleSolver != null)
     {
         ParticleSolver.Dispose();
     }
     if (Combiner != null)
     {
         Combiner.Dispose();
     }
 }
    // Start is called before the first frame update
    void Start()
    {
        player    = GameObject.FindGameObjectWithTag("Player");
        lifes     = player.GetComponent <Lifes>();
        health    = 2;
        invicible = false;

        GameObject[] hearts = GameObject.FindGameObjectsWithTag("Hearts");

        if (heart1 == null)
        {
            heart1 = hearts[0];
        }
        if (heart2 == null)
        {
            heart2 = hearts[1];
        }
    }
Ejemplo n.º 28
0
    // Start is called before the first frame update
    void Start()
    {
        player         = GameObject.FindGameObjectWithTag("Player");
        lifes          = player.GetComponent <Lifes>();
        rb2d           = this.GetComponent <Rigidbody2D>();
        regularGravity = Physics2D.gravity;

        if (cc2d == null)
        {
            cc2d = GetComponent <CircleCollider2D>();
        }

        if (mySprite == null)
        {
            mySprite = GetComponent <SpriteRenderer>();
        }

        gravityInWater     = new Vector2(0, -3);
        timeLeftUnderwater = timeToBreath;
    }
Ejemplo n.º 29
0
        private void timerLife_Tick(object sender, EventArgs e)
        {
            Seconds--;
            if (Seconds == 0)
            {
                Lifes        -= 1;
                lblTime.Text  = "TIME: " + Seconds.ToString();
                lblLifes.Text = "LIFES: " + Lifes.ToString();
                timerLife.Stop();
                newGame();
            }

            int y2 = random2.Next(-5, 5);

            eater1.Top += y2;

            int y3 = random2.Next(-3, 3);

            eater2.Left += y3;



            lblTime.Text  = "TIME: " + Seconds.ToString();
            lblLifes.Text = "LIFES: " + Lifes.ToString();

            Invalidate(true);

            if (Lifes == 0)
            {
                timerLife.Stop();
                GameOver     formp   = new GameOver();
                DialogResult resultp = formp.ShowDialog();
                if (resultp == System.Windows.Forms.DialogResult.Yes)
                {
                }
                else
                {
                    Application.Exit();
                }
            }
        }
Ejemplo n.º 30
0
 void FixedUpdate()
 {
     Constants.SetConstants(compute, constants.FixedDeltaTime);
     VelSimulation.Simulate();
     if (particleCollisionEnabled)
     {
         Collisions.Detect(2f * constants.radius);
     }
     for (var i = 0; i < 10; i++)
     {
         PolygonSolver.Solve();
         if (particleCollisionEnabled)
         {
             ParticleSolver.Solve();
         }
         Velocities.ClampMagnitude();
     }
     PosSimulation.Simulate();
     BoundsChecker.Check();
     Lifes.Simulate();
 }
Ejemplo n.º 31
0
    // Use this for initialization
    public override void Create()
    {
        Lifes.Add(intersect);
        Lifes.Add(place);
        Lifes.Add(bodyTransfer);
        Forms.Add(particles);
        Forms.Add(bodyVerts);
        Forms.Add(bodyTris);

        mesh = skin.gameObject.GetComponent <MeshFilter>();

        particles._Create(skin.verts);

        bodyVerts._Create(particles);
        bodyTris._Create(bodyVerts);

        place._Create();
        intersect._Create();
        bodyTransfer._Create();

        place.BindPrimaryForm("_VertBuffer", particles);
        place.BindForm("_SkinnedBuffer", skin.verts);
        place.BindAttribute("_Transform", "transformFloats", this);


        intersect.BindForm("_ParticleBuffer", particles);
        intersect.BindForm("_SkinnedVertBuffer", skin.verts);
        intersect.BindPrimaryForm("_SkinnedTriBuffer", skin.tris);
        intersect.BindAttribute("_RO", "RayOrigin", touch);
        intersect.BindAttribute("_RD", "RayDirection", touch);
        intersect.BindAttribute("_Transform", "transformFloats", this);

        bodyTransfer.BindAttribute("_CameraUp", "cameraUp", this);
        bodyTransfer.BindAttribute("_CameraLeft", "cameraLeft", this);
        bodyTransfer.BindAttribute("_Radius", "radius", this);

        bodyTransfer.BindPrimaryForm("_VertBuffer", bodyVerts);
        bodyTransfer.BindForm("_ParticleBuffer", particles);
    }