Example #1
0
 protected virtual void OnMouseDown()
 {
     Instantiate(deathAnimation, gameObject.transform.position, Quaternion.identity);
     Destroy(gameObject);
     pointsChanged.Invoke(PointsPerNPEntity);
     bonusBarStageChanged.Invoke(StagesPerNPEntity);
 }
Example #2
0
        public bool TryUsePoints(float pointCount, bool strict)
        {
            if (_currentActionPoints > 0f && (!strict || _currentActionPoints >= pointCount))
            {
                _currentActionPoints -= pointCount;

                if (PointsChanged != null)
                {
                    PointsChanged.Invoke();
                }

                if (_currentActionPoints <= 0f)
                {
                    if (AutoEndTurn)
                    {
                        EndTurn();
                    }

                    return(false);
                }

                return(true);
            }


            Debug.LogFormat("Not enough points: require {0} exists {1}", pointCount, _currentActionPoints);
            return(false);
        }
Example #3
0
 public List <ImagePoint> GetPoints()
 {
     if (ans == null)
     {
         ans = GetPointsInternal();
         PointsChanged?.Invoke(ans);
     }
     return(ans);
 }
Example #4
0
    private void AddPoints(int points)
    {
        var result = this.points + points;

        if (result < 0)
        {
            this.points = 0;
        }
        else
        {
            this.points = result;
        }

        PointsChanged?.Invoke(this.points);
    }
Example #5
0
        private void GameTime_Tick(object sender, EventArgs e)
        {
            if (_snake.IsColliding(_playgroundBounds))
            {
                _gameTime.Stop();
                Gameover?.Invoke(this, EventArgs.Empty);
                return;
            }

            if (_snake.CanEat(_meal))
            {
                _snake.Eat(_meal);
                CreateMeal();
                SetDifficulty();
                PointsChanged?.Invoke(this, EventArgs.Empty);
            }

            _snake.Move(_direction);
            Refresh();

            _updated = false;
        }
Example #6
0
 void OnMouseDown()
 {
     Destroy(gameObject);
     pointsChanged.Invoke(PointsPerBonusObject);
 }
Example #7
0
 public void OnPointsChanged(int _points)
 {
     PointsChanged?.Invoke(_points);
 }
Example #8
0
 public void InvokePointsChanged()
 {
     PointsChanged?.Invoke(this, null);
 }
Example #9
0
 void OnMouseDown()
 {
     pointsChanged.Invoke(PointsPerMissClick);
     bonusBarRestarted.Invoke();
 }
Example #10
0
 // Destroy objects outside of the screen
 void OnBecameInvisible()
 {
     Destroy(gameObject);
     pointsChanged.Invoke(-1);
 }