private void OnEnable()
 {
     asteroidsCount.ApplyChange(1);
     rend.sprite = asteroidSprites[0];
     DetermineInitialProperties();
     StartCoroutine(DelayDisablingAsteroid());
 }
        public void IncreaseLevel()
        {
            float dropSpeed = data.levels[level.GetValue() - 1].dropSpeed;

            level.ApplyChange(1);
            dropDelay.SetValue(dropSpeed);
            OnLvl?.Invoke();
        }
Exemple #3
0
 /// <summary>
 /// If the player successfully matches the wall
 /// </summary>
 public void Clear()
 {
     AudioSource.PlayClipAtPoint(SuccessSounds[Random.Range(0, SuccessSounds.Count - 1)], new Vector3(0.0f, 0.0f, -10.0f));
     Score.ApplyChange(1);
     GetComponent <BoxCollider2D>().enabled = false;
     StartCoroutine(Merge());
     //Destroy(gameObject);
 }
    public override void TakeDamage(int damage)
    {
        playerHealth.ApplyChange(-damage);
        PlayerDamaged.Raise();

        if (playerHealth.value <= 0)
        {
            Dead();
            PlayerDead.Raise();
        }
    }
Exemple #5
0
    public GameObject InstantiateBaby(Vector3 birthLocation)
    {
        GameObject baby = Instantiate(AgentsSharedParameters.AgentPrefab, birthLocation, Quaternion.identity);

        baby.transform.parent = _agentsParent.transform;
        AgentsBorn.ApplyChange(1);

        baby.name = "Agent " + AgentsBorn.Value;

        baby.GetComponent <Agent>().JustBorn = true;

        return(baby);
    }
    public void Buy()
    {
        if (Gold.Value > 100)
        {
            if (currentSelect == 0)
            {
                Gold.ApplyChange(-100);

                Item item = new Item();
                item.Init("HP", 10);

                Inventory.Instance.AddItem(item);
            }
            else if (currentSelect == 1)
            {
                Gold.ApplyChange(-100);

                Item item = new Item();
                item.Init("MP", 10);

                Inventory.Instance.AddItem(item);
            }
        }
    }
        public void Break()
        {
            BeforeBreak?.Invoke();

            ParticleSystem tempPs = Instantiate(ps);

            tempPs.transform.position = this.transform.position;
            tempPs.Play();
            sfxSet.Play();

            breakCount.ApplyChange(1);

            CameraShaker.Instance.ShakeOnce(Magnitude, Roughness, 0, FadeOutTime);

            OnBreak?.Invoke();
        }
        void Update()
        {
            timeBeforeNextBeatAtom.SetValue((float)(timeToNextBeat - AudioSettings.dspTime));
            timeSinceLastBeatAtom.SetValue((float)secondsPerBeat - timeBeforeNextBeatAtom.Value);

            if (!isPlaying || AudioSettings.dspTime < timeToNextBeat)
            {
                return;
            }

            timeToNextBeat = AudioSettings.dspTime + secondsPerBeat;
            RefreshValues();
            onBeatAtom.Raise();

            beatCountAtom.ApplyChange(1);
            ResolveDelayedCalls();
        }
    public void Simulate()
    {
        matchPanel.gameObject.SetActive(true);

        enemyOrderController.RenewEnemy();

        //result.text = "";
        //totalScore = 0;

        matchManager.m_orderManager.ConfirmOrder();

        if (reset)
        {
            for (int i = 0; i < matchManager.m_orderManager.order.Length; i++)
            {
                matchManager.m_orderManager.order[i].stats.Init();
            }
        }

        //平均スコアのため先にやる必要がある
        matches.ApplyChange(consecutiveMatches);


        for (int i = 0; i < consecutiveMatches; i++)
        {
            //innning by innning version
            StartCoroutine(matchManager.ExcuteMatch());
            //ここではcoroutineを開始しているだけで、処理の中断はない
            //つまり、これより↓のコードはすぐに実行されてしまう

            //scoreHistory.Add(matchManager.totalRuns);
            //Debug.Log(matchManager.totalRuns);
            // totalScore.ApplyChange(matchManager.totalRuns);


            //instant version
            //scoreHistory.Add(matchManager.ExcuteMatch());
        }


        //avgScore.text = ((float)totalScore.Value / matches.Value).ToString("n2");
    }
Exemple #10
0
        public void PlayNextGame()
        {
            if (isFinished)
            {
                return;
            }

            if (currentSequence.TryGetNextGame(out var newGame))
            {
                loadOperation = null;
                sequenceAdvancementAtom.ApplyChange(1);

                previousGame = currentGame;
                currentGame  = newGame;

                transitionScreenAnimator.SetTrigger(fadeInId);
            }
            else
            {
                EndCurrentSequence();
            }
        }
 public void EnemyKilled()
 {
     enemiesKilled.ApplyChange(1);
     enemiesAlive.ApplyChange(-1);
 }
 private void OnEnable()
 {
     enemiesCount.ApplyChange(1);
     DetermineStartingProperties();
     rend.sprite = avaliableSprites[Random.Range(0, avaliableSprites.Length - 1)];
 }