コード例 #1
0
 public bool ClickCheck()
 {
     if (ClickBox.Contains(Mouse.GetState().Position) && InputEngine.IsMouseLeftClick())
     {
         //Debug.WriteLine("ClickCheck Tile: " + IsWalkable);
         return(true);
     }
     return(false);
 }
コード例 #2
0
 public bool ClickCheck()
 {
     if (InputEngine.IsMouseLeftClick() && ClickBox.Contains(Mouse.GetState().Position) && !HasMoved && IsActive)
     {
         Debug.WriteLine("Clicked");
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #3
0
 public bool ClickCheck()
 {
     if (ClickBox.Contains(InputEngine.MousePosition) && InputEngine.IsMouseLeftClick())
     {
         //Debug.WriteLine("TRUE");
         return(true);
     }
     else
     {
         //Debug.WriteLine("FALSE");
         return(false);
     }
 }
コード例 #4
0
        //Overrides


        public override void Update(GameTime gameTime)
        {
            ClickBox = CollisionField;

            if (Health <= 0) //Checks if character is dead
            {
                Visible = false;
                IsDead  = true;
            }

            if (IsActive)
            {
                if (IsSelected)
                {
                    for (int i = MovementRange; i > 0; i--)
                    {
                        grid.CheckMoves(gridCell, i, teamNumber);
                    }
                    grid.CheckAttack(gridCell, MovementRange + AttackRange);

                    //IsSelected = !IsSelected;
                }

                if (IsSelected && InputEngine.IsMouseLeftClick()) //Executes movement script
                {
                    IsSelected = false;
                    Move(grid);
                    Debug.WriteLine("Move");

                    grid.ResetWalkable();
                }
                else if (!IsSelected && ClickCheck())
                {
                    IsSelected = true;
                    Debug.WriteLine("Selected");
                }
            }

            gridCell = new int[] { (int)Position.X / 64, (int)Position.Y / 64 };
            base.Update(gameTime);
        }