Ejemplo n.º 1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         onGameOver.Invoke();
     }
 }
Ejemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.CompareTag("Dot"))
     {
         addPoint.Invoke();
     }
 }
Ejemplo n.º 3
0
 public void OnSuccess(Puzzle puzzle, Slot slot)
 {
     remainingPuzzles--;
     if (remainingPuzzles == 0)
     {
         OnGameOver.Invoke();
     }
 }
Ejemplo n.º 4
0
 private void EnemyDied()
 {
     actualEnemyCount--;
     if (actualEnemyCount == 0)
     {
         EndGameEvent.Invoke();
     }
 }
Ejemplo n.º 5
0
    private void CheckOccupationLimit(SystemElementController hackedElement, VirusValue virus)
    {
        float occupation = elementList.PercentageOccupation(virus.Value);

        if (occupation >= OccupationLimit)
        {
            onGameOver.Invoke();
        }
    }
Ejemplo n.º 6
0
 public void OnPointerUp(PointerEventData eventData)
 {
     if (canBePressed)
     {
         trapIconRelesed.Invoke();
         canBePressed    = false;
         lastTimeRelesed = Time.timeSinceLevelLoad;
         cooldownTimerImage.fillAmount = 1;
         changeTimeScale.Invoke(1);
     }
 }
Ejemplo n.º 7
0
        //Dev part
        //private void Update()
        //{
        //    if (Input.GetKeyDown(KeyCode.Mouse0))
        //    {
        //        Shoot();
        //    }
        //}


        public void Shoot()
        {
            if (OnShootEvent != null)
            {
                OnShootEvent.Invoke();
            }

            GameObject bullet = bulletController.GetBullet();

            bullet.SetActive(true);
            bullet.transform.position = transform.position;
            var bulletClass = bullet.GetComponent <Bullet>();

            bulletClass.GetComponent <Rigidbody>().AddForce(transform.forward * bulletClass.bulletData.SpeedModifier);
        }
Ejemplo n.º 8
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player" && Helper.distance(transform.position, collision.transform.position) < 1.3f)
     {
         audioSource.Play();
         if (enemyController != null)
         {
             addPoints.Invoke(enemyController.enemiesCount);
         }
         SaveLoadDataController.LoadedData.playerLevel++;
         SaveLoadDataController.SaveData();
         levelPassed.Invoke();
         player.GetComponent <PlayerControler>().CanMove = false;
     }
 }
Ejemplo n.º 9
0
    private void NextTurn()
    {
        OnBeforeTurnChange.Invoke();

        activeVirus.Value.enabled = false;

        playerIndex = (playerIndex + 1) % players.Length;

        activeVirus.Value         = players[playerIndex];
        activeVirus.Value.enabled = true;

        if (playerIndex == 0)
        {
            currentTurn.Value++;
        }

        OnTurnChanged.Invoke();
    }
Ejemplo n.º 10
0
    //TODO: sprawdzić, czy da się wykonać kolorowanie i nadawanie koordynatów jednocześnie
    private IEnumerator ManageTiles(HexMapGenerator mapGenerator)
    {
        yield return(null);

        yield return(mapGenerator.GenerateMap());

        hexTileList = mapGenerator.TileList;

        ColorTiles();
        GenerateSystemElements();

        var hexagonalCoordinateController = new HexagonalCoordinateController(hexTileList.First());

        hexagonalCoordinateController.ApplyCoordinates();

        yield return(new WaitForEndOfFrame());

        onMapGeneratedEvent.Invoke();
    }
Ejemplo n.º 11
0
    private void Die()
    {
        audioSource.clip = dieSound;
        audioSource.Play();
        if (addPoints != null)
        {
            addPoints.Invoke(Mathf.CeilToInt(actualUnitStatistic.MaxHP / 2f));
        }

        if (playerDied != null)
        {
            playerDied.Invoke();
            SaveLoadDataController.ClearData();
        }

        DropLoot();

        dead = true;
        gameObject.SetActive(false);
    }
Ejemplo n.º 12
0
    public void GetDamage(int damage)
    {
        if (PlayerHitEvent != null)
        {
            PlayerHitEvent.Invoke();
        }

        if (damage >= ActualHealthPoint)
        {
            ActualHealthPoint     = 0;
            actualPercentOfHealth = 0;
            gameObject.SendMessage("Die");
        }
        else
        {
            ActualHealthPoint    -= damage;
            actualPercentOfHealth = (int)ActualHealthPoint * 100 / startingHealthPoint;
        }

        healthBar.fillAmount = actualPercentOfHealth / 100f;
    }
Ejemplo n.º 13
0
 private void Die()
 {
     endGameEvent.Invoke();
 }
Ejemplo n.º 14
0
 private void Die()
 {
     EnemyDiedEvent.Invoke();
     gameObject.SetActive(false);
 }
Ejemplo n.º 15
0
 public void Invoke()
 {
     eventToInvoke.Invoke();
 }
Ejemplo n.º 16
0
 public void Play()
 {
     onImageSelected.Invoke();
     SceneManager.LoadScene(gameSceneIndex);
 }
Ejemplo n.º 17
0
 public void OnLeveOptions()
 {
     PlayerPrefs.SetInt(OptionsEnum.SoundsOn.ToString(), SoundsOn ? 1 : 0);
     PlayerPrefs.SetInt(OptionsEnum.SoundsVolume.ToString(), SoundsVolume);
     updateVolume.Invoke();
 }