Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
 public List <ImagePoint> GetPoints()
 {
     if (ans == null)
     {
         ans = GetPointsInternal();
         PointsChanged?.Invoke(ans);
     }
     return(ans);
 }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        // Scoring support
        pointsChanged = new PointsChanged();
        EventManager.AddPointsChangedInvoker(this);

        //Bonus streak support
        bonusBarRestarted = new BonusBarRestarted();
        EventManager.AddBonusBarRestartedInvoker(this);
    }
Exemplo n.º 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);
    }
Exemplo n.º 5
0
    protected void Start()
    {
        // Scoring support
        pointsChanged = new PointsChanged();
        EventManager.AddPointsChangedInvoker(this);

        //Bonus streak support
        bonusBarStageChanged = new BonusBarStageChanged();
        EventManager.AddBonusBarStageChangedInvoker(this);

        // Apply impulse force to get bird moving
        const float MinImpulseForce = 2f;
        const float MaxImpulseForce = 4f;
        //float angle = Random.Range(0, 2 * Mathf.PI);
        Vector2 direction = new Vector2(flyDirection, 0);
        float   magnitude = UnityEngine.Random.Range(MinImpulseForce, MaxImpulseForce);

        GetComponent <Rigidbody2D>().AddForce(
            direction * magnitude,
            ForceMode2D.Impulse);
    }
Exemplo n.º 6
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;
        }
Exemplo n.º 7
0
 void Start()
 {
     // scoring support
     pointsChanged = new PointsChanged();
     EventManager.AddPointsChangedInvoker(this);
 }
Exemplo n.º 8
0
 public void OnPointsChanged(int _points)
 {
     PointsChanged?.Invoke(_points);
 }
Exemplo n.º 9
0
 public void InvokePointsChanged()
 {
     PointsChanged?.Invoke(this, null);
 }
Exemplo n.º 10
0
 public void AddPoints(int value)
 {
     Points += value;
     PointsChanged.SafeInvoke(Points);
 }
Exemplo n.º 11
0
 public void StartGame()
 {
     Points = 0;
     PointsChanged.SafeInvoke(Points);
 }
Exemplo n.º 12
0
 public void Start()
 {
     pointsChanged = new PointsChanged();
     //EventManager.AddPointsChangedInvoker(this);
 }