コード例 #1
0
 public virtual void Update(GameTime gameTime)
 {
     if (currentState.Equals(ItemState.Moving) || currentState.Equals(ItemState.Bounce))
     {
         MovingTime++;
     }
     if (MovingTime >= maxMovingTime)
     {
         itemSprite = null;
     }
     if (itemSprite != null && currentState != ItemState.Taken)
     {
         if (currentState.Equals(ItemState.Moving))
         {
             HandleHorizontalMovement();
             Fall(gameTime);
         }
         if (this.isInBlock)
         {
             this.isInvisible = false;
             yDifference      = moveUpVelocity * ((float)gameTime.ElapsedGameTime.Milliseconds / FIFTY);
             if (position.Y + this.itemSprite.Height > originalY)
             {
                 position.Y -= yDifference;
             }
             else
             {
                 this.Move();
                 this.isInBlock = false;
             }
         }
         itemSprite.Update(gameTime, (int)position.X, (int)position.Y);
     }
 }
コード例 #2
0
    /// <summary>
    /// Changes the item state to the given state.
    /// </summary>
    public void ChangeItemState(ItemState newState)
    {
        currentState = newState;

        if (newState.Equals(ItemState.destroyed) || newState.Equals(ItemState.collected))
        {
            transform.gameObject.SetActive(false);
        }
        else
        {
            SetInteractivity(true);
        }
    }
コード例 #3
0
        protected internal Boolean PropertyChanged(String oldValue, String newValue)
        {
            if (state.Equals(ItemState.Unchanged).IsFalse())
            {
                return(true);
            }

            if (oldValue.NotEquals(newValue))
            {
                state = ItemState.Modified;
                return(true);
            }
            return(false);
        }
コード例 #4
0
        void UpdatePrState(SupportedGitHubRepos supportedRepo, long prNumber, ItemState prCurrentState, ItemState prNewState)
        {
            if (prCurrentState.Equals(prNewState))
            {
                Logger.LogInfo("Pr#'{0}', requested state '{1}' and current state '{2}' are same. Exiting.....", prNumber.ToString(), prNewState.ToString(), prCurrentState.ToString());
            }

            Repository  r  = GetRepository(supportedRepo);
            PullRequest pr = GetPullRequest(r.Name, prNumber);

            Logger.LogInfo("Pr#'{0}', requested state to be set:'{1}', current state is:'{2}'", prNumber.ToString(), prNewState.ToString(), pr.State.ToString());

            if (pr.State == prCurrentState)
            {
                PullRequestUpdate pru = new PullRequestUpdate();
                pru.State = prNewState;
                pr        = OC.PullRequest.Update(r.Id, (int)prNumber, pru).GetAwaiter().GetResult();

                Logger.LogInfo("Pr#'{0}', requested state to be set:'{1}', current state is:'{2}'", prNumber.ToString(), prNewState.ToString(), pr.State.ToString());
            }

            if (!pr.State.Equals(prNewState))
            {
                Logger.LogError("Unable to set PR state to:'{0}'", prNewState.ToString());
            }
        }