Пример #1
0
 private bool checkProvability()
 {
     foreach (INode nodeLeft in currentEquation.getLeft().getChildren())
     {
         foreach (INode nodeRight in currentEquation.getRight().getChildren())
         {
             if (nodeLeft is Atom && nodeRight is Atom)
             {
                 if (((Atom)nodeLeft).getString().Equals(((Atom)nodeRight).getString()))
                 {
                     if (currentEquation.getLeft().getChildren().Count() != 1 ||
                         currentEquation.getRight().getChildren().Count() != 1)
                     {
                         LeftOrRight left  = new LeftOrRight();
                         LeftOrRight right = new LeftOrRight();
                         left.appendChild(nodeLeft.deepCopy());
                         right.appendChild(nodeRight.deepCopy());
                         terminalTo = new To(left, right);
                         children.Add(new Proof(terminalTo));
                     }
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Пример #2
0
        public override void ExitRightOrLeft([NotNull] FormulaParser.RightOrLeftContext context)
        {
            Console.WriteLine("ExitRightOrLeft start, stack count = " + stack.Count());
            base.ExitRightOrLeft(context);
            LeftOrRight lr = new LeftOrRight();

            if (isLeftFinished)
            {
                int stackCount = stack.Count();
                for (int i = 0; i < stackCount - 1; i++)
                {
                    lr.appendChild(stack.Pop());
                }
            }
            else
            {
                while (stack.Any())
                {
                    lr.appendChild(stack.Pop());
                }
                isLeftFinished = true;
            }

            stack.Push(lr);
        }
Пример #3
0
        public void MatchLeft_correctly_applies_logic_to_left()
        {
            var either = new LeftOrRight(new Left("Frodo"));
            var result = either.MatchLeft(x => x.Name);

            Assert.Equal(Optional.Create("Frodo"), result);
        }
Пример #4
0
        public void MatchOptional_correctly_applies_logic_to_right()
        {
            var either = new LeftOrRight(new Right(4));
            var result = either.MatchRight(x => x.Number * 2);

            Assert.Equal(Optional.Create <int>(8), result);
        }
Пример #5
0
        public void MatchRight_correctly_returns_none_when_left_is_defined()
        {
            var either = new LeftOrRight(new Left("Samwise"));
            var result = either.MatchRight(x => x.Number);

            Assert.Equal(Optional.None <int>(), result);
        }
Пример #6
0
        /// <summary>
        /// When a building is clicked we should bring up two buttons
        /// 1) Edit building properties box
        /// 2) Delete building
        /// </summary>
        /// <param name="mousePosition">Position of the mouse while clicking me</param>
        /// <param name="clickType">The type of clicking going no</param>
        public override void Clicked(Pair <int> mousePosition, LeftOrRight clickType)
        {
            this.editButton.Enabled   = true;
            this.deleteButton.Enabled = true;

            base.Clicked(mousePosition, clickType);
        }
Пример #7
0
        /// <summary>
        /// There is a new challenger for screen focus!
        /// Do the logic for giving focus to this new element.
        ///
        /// Note: There should only be a single "Click" per update step.
        ///         So the "Neither" enumeration is added to the LeftOrRight type.
        ///         "Neither" clicks should fire focus changes, but not click changes.
        ///         There are still problems with this method. Be careful with inadvertant recursion!
        /// </summary>
        /// <param name="element">The new element to get focus</param>
        /// <param name="clickType">Left of right click</param>
        public void SetNewFocus(ScreenElement element, LeftOrRight clickType)
        {
            // If nothing new is getting focus, then remove focus
            if (element == null)
            {
                if (this.screenFocus != null)
                {
                    this.screenFocus.UnClicked(null);
                    this.screenFocus = null;
                }
                return;
            }

            // Trigger Clicked and UnClicked events
            if (this.screenFocus == null)
            {
                this.screenFocus = element;
                element.Clicked(Input.MouseWorldPosition, clickType);
            }
            else if (this.screenFocus.Equals(element))
            {
                element.Clicked(Input.MouseWorldPosition, clickType);
            }
            else
            {
                screenFocus.UnClicked(element);
                this.screenFocus = element;
                element.Clicked(Input.MouseWorldPosition, clickType);
            }
        }
Пример #8
0
    //タップされているかどうかを調べる
    private void CheckTapping(VROverlayIntersectionResults_t results, LeftOrRight lr, ref bool tapped)
    {
#pragma warning disable 0219
        string Tag = "[" + this.GetType().Name + ":" + System.Reflection.MethodBase.GetCurrentMethod(); //クラス名とメソッド名を自動取得
#pragma warning restore 0219

        //コントローラとオーバーレイの距離が一定以下なら
        if (results.fDistance < config.TapOnDistance && !tapped)
        {
            //タップされた
            tapped = true;
            haptic(lr);

            //クリック処理(完全ロックでない場合)
            if (tapEnable)
            {
                uGUIclick(results);
            }
        }
        //コントローラとオーバーレイの距離が一定以上なら
        if (results.fDistance > config.TapOffDistance && tapped)
        {
            //離れた
            tapped = false;
            haptic(lr);
        }
    }
Пример #9
0
    public void EquipItem(RunnerMod newMod, LeftOrRight leftOrRight)
    {
        switch (newMod.GetItemType())
        {
        case Item.ItemTypes.Arm:
            if (leftOrRight == LeftOrRight.Left)
            {
                leftArm = newMod;
            }
            else if (leftOrRight == LeftOrRight.Right)
            {
                rightArm = newMod;
            }
            break;

        case Item.ItemTypes.Leg:
            if (leftOrRight == LeftOrRight.Left)
            {
                leftLeg = newMod;
            }
            else if (leftOrRight == LeftOrRight.Right)
            {
                rightLeg = newMod;
            }
            break;
        }
    }
Пример #10
0
        public void MatchLeft_correctly_returns_none_when_right_is_defined()
        {
            var either = new LeftOrRight(new Right(4));
            var result = either.MatchLeft(x => x.Name);

            Assert.Equal(Optional.None <string>(), result);
        }
Пример #11
0
 /// <summary>
 /// This method is called if the element is clickable and has been clicked.
 /// It will be executed before the Update call on the tick.
 /// </summary>
 /// <param name="mousePosition">Mouse world position that has been clicked</param>
 /// <param name="clickType">Tells if the click was with left or right mouse key</param>
 public virtual void Clicked(Pair <int> mousePosition, LeftOrRight clickType)
 {
     if (clickType == LeftOrRight.Left || clickType == LeftOrRight.Neither)
     {
         this.GiveFocus();
     }
 }
Пример #12
0
        public override void Empty()
        {
            base.Empty();

            Magnitude        = 0.0D;
            DirectionToSteer = LeftOrRight.Unknown;
        }
Пример #13
0
        public override bool Parse(Sentence sentence)
        {
            /*
            ** XTR - Cross Track Error - Dead Reckoning
            **
            **        1   2 3 4
            **        |   | | |
            ** $--XTR,x.x,a,N*hh<CR><LF>
            **
            ** Field Number:
            **  1) Magnitude of cross track error
            **  2) Direction to steer, L or R
            **  3) Units, N = Nautical Miles
            **  4) Checksum
            */

            /*
            ** First we check the checksum...
            */

            if (sentence.IsChecksumBad() == NMEA.Boolean.True)
            {
                Empty();
                return(false);
            }

            Magnitude        = sentence.Double(1);
            DirectionToSteer = sentence.LeftOrRight(2);

            return(true);
        }
Пример #14
0
        public override bool Parse(Sentence sentence)
        {
            /*
            ** RMB - Recommended Minimum Navigation Information
            **                                                             14
            **        1 2   3 4    5    6       7 8        9 10  11  12  13|
            **        | |   | |    |    |       | |        | |   |   |   | |
            ** $--RMB,A,x.x,a,c--c,c--c,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,A*hh<CR><LF>
            **
            ** Field Number:
            **  1) Status, V = Navigation receiver warning
            **  2) Cross Track error - nautical miles
            **  3) Direction to Steer, Left or Right
            **  4) TO Waypoint ID
            **  5) FROM Waypoint ID
            **  6) Destination Waypoint Latitude
            **  7) N or S
            **  8) Destination Waypoint Longitude
            **  9) E or W
            ** 10) Range to destination in nautical miles
            ** 11) Bearing to destination in degrees True
            ** 12) Destination closing velocity in knots
            ** 13) Arrival Status, A = Arrival Circle Entered
            ** 14) Checksum
            */

            /*
            ** First we check the checksum...
            */

            if (sentence.IsChecksumBad() == Boolean.True)
            {
                Empty();
                return(false);
            }

            IsDataValid      = sentence.Boolean(1);
            CrossTrackError  = sentence.Double(2);
            DirectionToSteer = sentence.LeftOrRight(3);
            From             = sentence.Field(4);
            To = sentence.Field(5);
            DestinationPosition.Parse(6, 7, 8, 9, sentence);
            RangeToDestinationNauticalMiles = sentence.Double(10);
            BearingToDestinationDegreesTrue = sentence.Double(11);
            DestinationClosingVelocityKnots = sentence.Double(12);
            IsArrivalCircleEntered          = sentence.Boolean(13);

            int checksum_field_number = sentence.ChecksumFieldNumber();

            if (checksum_field_number == 15)
            {
                Mode = sentence.FAAMode(14);
            }
            else
            {
                Mode = FAAModeIndicator.Unknown;
            }

            return(true);
        }
Пример #15
0
        /// <summary>
        /// When clicked, we should start the ghosting construction process
        /// </summary>
        /// <param name="mousePosition"></param>
        public override void Clicked(Pair <int> mousePosition, LeftOrRight clickType)
        {
            base.Clicked(mousePosition, clickType);

            if (clickType == LeftOrRight.Left)
            {
                GameScreen.BeginBuilding(this.data.Key);
            }
        }
Пример #16
0
 public Master(string line)
 {
   string[] fields = line.Split(',');
   int i = 0;
   lahmanID = UInt16.Parse(fields[i++]);
   playerID = fields[i++].Trim('\"');
   managerID = fields[i++].Trim('\"');
   hofID = fields[i++].Trim('\"');
   UInt16.TryParse(fields[i++], out birthYear);
   UInt16.TryParse(fields[i++], out birthMonth);
   UInt16.TryParse(fields[i++], out birthDay);
   birthCountry = fields[i++].Trim('\"');
   birthState = fields[i++].Trim('\"');
   birthCity = fields[i++].Trim('\"');
   UInt16.TryParse(fields[i++], out deathYear);
   UInt16.TryParse(fields[i++], out deathMonth);
   UInt16.TryParse(fields[i++], out deathDay);
   deathCountry = fields[i++].Trim('\"');
   deathState = fields[i++].Trim('\"');
   deathCity = fields[i++].Trim('\"');
   nameFirst = fields[i++].Trim('\"');
   nameLast = fields[i++].Trim('\"');
   nameNote = fields[i++].Trim('\"');
   nameGiven = fields[i++].Trim('\"');
   nameNick = new string[1];
   nameNick[0] = fields[i++].Trim('\"');
   while (fields[i].Length > 0 && UInt16.TryParse(fields[i].Trim('\"'), out weight) == false)
   {
     Array.Resize(ref nameNick, nameNick.Length + 1);
     nameNick[nameNick.Length - 1] = fields[i++].Trim('\"');
   }
   i++;
   float.TryParse(fields[i++], out height);
   if (fields[i].Length > 0)
     bats = fields[i++] == "L" ? LeftOrRight.Left : LeftOrRight.Right;
   else
   {
     i++;
     bats = LeftOrRight.Unknown;
   }
   if (fields[i].Length > 0)
     throws = fields[i++] == "L" ? LeftOrRight.Left : LeftOrRight.Right;
   else
   {
     i++;
     throws = LeftOrRight.Unknown;
   }
   DateTime.TryParse(fields[i++], out debut);
   DateTime.TryParse(fields[i++], out finalGame);
   college = fields[i++].Trim('\"');
   lahman40ID = fields[i++].Trim('\"');
   lahman45ID = fields[i++].Trim('\"');
   retroID = fields[i++].Trim('\"');
   holtzID = fields[i++].Trim('\"');
   bbrefID = fields[i++].Trim('\"');
 }
Пример #17
0
        public override void ExitTo([NotNull] FormulaParser.ToContext context)
        {
            Console.WriteLine("ExitTo start, stack count = " + stack.Count());
            base.EnterTo(context);
            LeftOrRight right = (LeftOrRight)stack.Pop();
            LeftOrRight left  = (LeftOrRight)stack.Pop();
            To          to    = new To(left, right);

            stack.Push(to);
        }
Пример #18
0
        public void LeftOrRightTest()
        {
            var target       = new Sentence();    // TODO: Initialize to an appropriate value
            int field_number = 0;                 // TODO: Initialize to an appropriate value
            var expected     = new LeftOrRight(); // TODO: Initialize to an appropriate value
            var actual       = target.LeftOrRight(field_number);

            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #19
0
        public override void Empty()
        {
            base.Empty();

            RelativeWindAngle                  = 0.0D;
            RelativeDirection                  = LeftOrRight.Unknown;
            MeasuredWindSpeedKnots             = 0.0D;
            MeasuredWindSpeedMetersPerSecond   = 0.0D;
            MeasuredWindSpeedKilometersPerHour = 0.0D;
        }
Пример #20
0
        public override void Empty()
        {
            base.Empty();

            CalculatedWindAngle                  = 0.0D;
            CalculatedDirection                  = LeftOrRight.Unknown;
            CalculatedWindSpeedKnots             = 0.0D;
            CalculatedWindSpeedMetersPerSecond   = 0.0D;
            CalculatedWindSpeedKilometersPerHour = 0.0D;
        }
Пример #21
0
 private void SwitchDirection()
 {
     if (this.platformDirection == LeftOrRight.Right)
     {
         this.platformDirection = LeftOrRight.Left;
     }
     else
     {
         this.platformDirection = LeftOrRight.Right;
     }
 }
Пример #22
0
        public override void Empty()
        {
            base.Empty();

            IsLoranBlinkOK           = Boolean.Unknown;
            IsLoranCCycleLockOK      = Boolean.Unknown;
            CrossTrackErrorMagnitude = 0.0D;
            DirectionToSteer         = LeftOrRight.Unknown;
            CrossTrackUnits          = string.Empty;
            FAAMode = FAAModeIndicator.Unknown;
        }
Пример #23
0
        /// <summary>
        /// When a path is right-clicked we should delete it
        /// </summary>
        /// <param name="mousePosition">Position of the mouse while clicking me</param>
        /// <param name="clickType">The type of clicking going no</param>
        public override void Clicked(Pair <int> mousePosition, LeftOrRight clickType)
        {
            base.Clicked(mousePosition, clickType);

            if (clickType == LeftOrRight.Right)
            {
                CampusManager.Instance.DeleteElement(this);
                this.DirtySurroundingBits();
                this.Delete();
            }
        }
Пример #24
0
        public override bool Parse(Sentence sentence)
        {
            /*
            ** XTE - Cross-Track Error, Measured
            **
            **        1 2 3   4 5  6
            **        | | |   | |  |
            ** $--XTE,A,A,x.x,a,N,*hh<CR><LF>
            **
            **  1) Status
            **     V = LORAN-C Blink or SNR warning
            **     V = general warning flag or other navigation systems when a reliable
            **         fix is not available
            **  2) Status
            **     V = Loran-C Cycle Lock warning flag
            **     A = OK or not used
            **  3) Cross Track Error Magnitude
            **  4) Direction to steer, L or R
            **  5) Cross Track Units, N = Nautical Miles
            **  6) Checksum
            */

            /*
            ** First we check the checksum...
            */

            if (sentence.IsChecksumBad() == Boolean.True)
            {
                Empty();
                return(false);
            }

            IsLoranBlinkOK           = sentence.Boolean(1);
            IsLoranCCycleLockOK      = sentence.Boolean(2);
            CrossTrackErrorMagnitude = sentence.Double(3);
            DirectionToSteer         = sentence.LeftOrRight(4);
            CrossTrackUnits          = sentence.Field(5);

            int checksum_field_number = sentence.ChecksumFieldNumber();

            if (checksum_field_number == 7)
            {
                FAAMode = sentence.FAAMode(6);
            }
            else
            {
                FAAMode = FAAModeIndicator.Unknown;
            }

            return(true);
        }
Пример #25
0
        public override void Empty()
        {
            base.Empty();

            IsDataValid      = Boolean.Unknown;
            CrossTrackError  = 0.0D;
            DirectionToSteer = LeftOrRight.Unknown;
            To   = string.Empty;
            From = string.Empty;
            DestinationPosition.Empty();
            RangeToDestinationNauticalMiles = 0.0D;
            BearingToDestinationDegreesTrue = 0.0D;
            DestinationClosingVelocityKnots = 0.0D;
            IsArrivalCircleEntered          = Boolean.Unknown;
            Mode = NMEA.FAAModeIndicator.Unknown;
        }
Пример #26
0
        /// <summary>
        /// Create the actual building at this position
        /// </summary>
        /// <param name="mousePosition"></param>
        public override void Clicked(Pair <int> mousePosition, LeftOrRight clickType)
        {
            base.Clicked(mousePosition, clickType);

            if (clickType == LeftOrRight.Right)
            {
                if (this.startClickLocation != null)
                {
                    this.startClickLocation = null;
                    this.segments           = new List <PathSegment>();
                }
                else
                {
                    GameScreen.BeginBuilding(null);
                }
            }
        }
Пример #27
0
 // Start is called before the first frame update
 void Start()
 {
     this.player                = PlayerStatistics.instance.gameObject;
     playerParent               = player.transform.parent.gameObject;
     this.platformDirection     = LeftOrRight.Right;
     this.start_position        = new Vector3(transform.position.x, transform.position.y, transform.position.z);
     this.start_position        = this.transform.position;
     this.end_position_slider   = start_position + transform.forward * distance * (int)platformDirection;
     this.end_position_elevator = start_position + transform.up * distance * (int)platformDirection;
     this.start_rotation        = this.transform.rotation;
     this.end_rotation          = Quaternion.Euler(start_rotation.eulerAngles.x + distance, start_rotation.eulerAngles.y, start_rotation.eulerAngles.z);
     this.TimePassed            = 0;
     this.durationTime          = 1.0f * distance;
     this.once         = true;
     this.triggerPopUp = false;
     this.isScaling    = false;
 }
Пример #28
0
        /// <summary>
        /// Create the actual building at this position
        /// </summary>
        /// <param name="mousePosition"></param>
        public override void Clicked(Pair<int> mousePosition, LeftOrRight clickType)
        {
            base.Clicked(mousePosition, clickType);

            if (clickType == LeftOrRight.Right)
            {
                if (this.startClickLocation != null)
                {
                    this.startClickLocation = null;
                    this.segments = new List<PathSegment>();
                }
                else
                {
                    GameScreen.BeginBuilding(null);
                }
            }
        }
Пример #29
0
    void FollowPlayer()
    {
        // Check if player is on same platform and if so change direction to follow it
        var onSamePlatform = IsOnSamePlatformAsPlayer();

        if (!onSamePlatform)
        {
            followingPlayer = false;
            return;
        }

        if (onSamePlatform)
        {
            followingPlayer = true;
            var relativeDirection = LeftOrRight.GetRelativeDirection(player.gameObject, gameObject);
            directionOfMovement = relativeDirection;
        }
    }
Пример #30
0
        ///// <summary>
        ///// Get headset fov
        ///// </summary>
        ///// <returns></returns>
        //public static float GetFov()
        //{
        //    float[] inputs = new float[1];
        //    inputs[0] = 4;
        //    float[] result = new float[1];
        //    if (SZVR_GetData(inputs, result))
        //    {
        //        return result[0];
        //    }
        //    else
        //    {
        //        return 0;
        //    }
        //}

        /// <summary>
        /// Get Wand position and orientaion.
        /// </summary>
        /// <param name="LR"> LR Hand </param>
        /// <param name="position">position</param>
        /// <param name="rotation">Quaternion</param>
        /// <param name="buttonEvent"></param>
        public static void GetWandPosAndRot(LeftOrRight LR, ref Vector3 position, ref Quaternion rotation, out ThreeGlassesWandButtonEvent.ButtonEvent buttonEvent)
        {
            position    = Vector3.zero;
            rotation    = Quaternion.identity;
            buttonEvent = ThreeGlassesWandButtonEvent.ButtonEvent.NoneEvent;

            var quaternion_array = new float[4];
            var position_array   = new float[3];       // 0.x 1.y 2.z
            var key_status       = new uint[1];
            var trigger_value    = new byte[] { 255 }; // min:0, max:255
            var stick            = new byte[2];        // 0.x 1.y

            if (SZVR_GetWandData(
                    quaternion_array,
                    position_array,
                    key_status,
                    trigger_value,
                    stick,
                    LR == LeftOrRight.Right))
            {
                buttonEvent = new ThreeGlassesWandButtonEvent.ButtonEvent(key_status[0], trigger_value[0], stick, LR);
            }

            if (LR == LeftOrRight.Left)
            {
                position.x      = checkFloat(position_array[0]) ? -position_array[0] : LastLeftVector3.x;
                position.y      = checkFloat(position_array[1]) ? position_array[1] : LastLeftVector3.y;
                position.z      = checkFloat(position_array[2]) ? position_array[2] : LastLeftVector3.z;
                LastLeftVector3 = position;
            }
            else
            {
                position.x       = checkFloat(position_array[0]) ? -position_array[0] : LastRightVector3.x;
                position.y       = checkFloat(position_array[1]) ? position_array[1] : LastRightVector3.y;
                position.z       = checkFloat(position_array[2]) ? position_array[2] : LastRightVector3.z;
                LastRightVector3 = position;
            }

            rotation.x = checkFloat(quaternion_array[2]) ? quaternion_array[2] : 0;
            rotation.y = -(checkFloat(quaternion_array[0]) ? quaternion_array[0] : 0);
            rotation.z = checkFloat(quaternion_array[1]) ? quaternion_array[1] : 0;
            rotation.w = -(checkFloat(quaternion_array[3]) ? quaternion_array[3] : 0);
        }
Пример #31
0
        public void ReactToCollision(CCPoint reposition)
        {
            ProjectVelocityOnSurface(reposition);

            // account for floating point error:
            const float epsilon = .0001f;

            if (System.Math.Abs(reposition.X) > epsilon)
            {
                if (reposition.X > 0 && directionFacing == LeftOrRight.Left)
                {
                    directionFacing = LeftOrRight.Right;
                }
                else if (reposition.X < 0 && directionFacing == LeftOrRight.Right)
                {
                    directionFacing = LeftOrRight.Left;
                }
            }
        }
Пример #32
0
		public void ReactToCollision(CCPoint reposition)
		{
			ProjectVelocityOnSurface (reposition);

			// account for floating point error:
			const float epsilon = .0001f;

			if (System.Math.Abs (reposition.X) > epsilon)
			{
				if (reposition.X > 0 && directionFacing == LeftOrRight.Left)
				{
					directionFacing = LeftOrRight.Right;
				}
				else if (reposition.X < 0 && directionFacing == LeftOrRight.Right)
				{
					directionFacing = LeftOrRight.Left;
				}
			}
		}
Пример #33
0
    //振動フィードバックを行う
    private void haptic(LeftOrRight lr)
    {
#pragma warning disable 0219
        string Tag = "[" + this.GetType().Name + ":" + System.Reflection.MethodBase.GetCurrentMethod(); //クラス名とメソッド名を自動取得
#pragma warning restore 0219

        //左手コントローラーが有効かチェック
        uint Leftidx = openvr.GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole.LeftHand);
        if (Leftidx != OpenVR.k_unTrackedDeviceIndexInvalid && lr == LeftOrRight.Left)
        {
            //ぶるっと
            openvr.TriggerHapticPulse(Leftidx, 0, 3000);
        }
        //右手コントローラーが有効かチェック
        uint Rightidx = openvr.GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole.RightHand);
        if (Rightidx != OpenVR.k_unTrackedDeviceIndexInvalid && lr == LeftOrRight.Right)
        {
            //ぶるっと
            openvr.TriggerHapticPulse(Rightidx, 0, 3000);
        }
    }
Пример #34
0
        /// <summary>
        /// Create the actual building at this position
        /// </summary>
        /// <param name="mousePosition"></param>
        public override void Clicked(Pair<int> mousePosition, LeftOrRight clickType)
        {
            base.Clicked(mousePosition, clickType);

            if (clickType == LeftOrRight.Left)
            {
                if (this.isValidBuilding)
                {
                    CampusManager.Instance.CreateBuilding(this.Position.Clone(), this.Size.Clone(), this.data);

                    // If shift is held then we can build multiple buildings
                    if (!Input.KeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift) && !Input.KeyDown(Microsoft.Xna.Framework.Input.Keys.RightShift))
                    {
                        GameScreen.BeginBuilding(null);
                    }
                }
            }
            else if (clickType == LeftOrRight.Right)
            {
                GameScreen.BeginBuilding(null);
            }
        }
Пример #35
0
        public void ReactToCollision(CCPoint reposition)
        {
            //enemy是一直在走,遇到墙就回头

            //更新Collision后player的速度
            ProjectVelocityOnSurface (reposition);

            // account for floating point error:
            //考虑floating point最小不为0
            const float epsilon = .0001f;

            if (System.Math.Abs (reposition.X) > epsilon)
            {
                //enemy撞墙就回头
                if (reposition.X > 0 && directionFacing == LeftOrRight.Left)
                {
                    directionFacing = LeftOrRight.Right;
                }
                else if (reposition.X < 0 && directionFacing == LeftOrRight.Right)
                {
                    directionFacing = LeftOrRight.Left;
                }
            }
        }
Пример #36
0
        /// <summary>
        /// When a building is clicked we should bring up two buttons
        /// 1) Edit building properties box
        /// 2) Delete building
        /// </summary>
        /// <param name="mousePosition">Position of the mouse while clicking me</param>
        /// <param name="clickType">The type of clicking going no</param>
        public override void Clicked(Pair<int> mousePosition, LeftOrRight clickType)
        {
            this.editButton.Enabled = true;
            this.deleteButton.Enabled = true;

            base.Clicked(mousePosition, clickType);
        }
Пример #37
0
        /// <summary>
        /// When a path is right-clicked we should delete it
        /// </summary>
        /// <param name="mousePosition">Position of the mouse while clicking me</param>
        /// <param name="clickType">The type of clicking going no</param>
        public override void Clicked(Pair<int> mousePosition, LeftOrRight clickType)
        {
            base.Clicked(mousePosition, clickType);

            if (clickType == LeftOrRight.Right)
            {
                CampusManager.Instance.DeleteElement(this);
                this.DirtySurroundingBits();
                this.Delete();
            }
        }
Пример #38
0
 /// <summary>
 /// This method is called if the element is clickable and has been clicked.
 /// It will be executed before the Update call on the tick.
 /// </summary>
 /// <param name="mousePosition">Mouse world position that has been clicked</param>
 /// <param name="clickType">Tells if the click was with left or right mouse key</param>
 public virtual void Clicked(Pair<int> mousePosition, LeftOrRight clickType)
 {
     if (clickType == LeftOrRight.Left || clickType == LeftOrRight.Neither)
     {
         this.GiveFocus();
     }
 }
Пример #39
0
 /// <summary>
 /// Delete the parent.
 /// </summary>
 /// <param name="mousePosition"></param>
 /// <param name="clickType"></param>
 public override void Clicked(Pair<int> mousePosition, LeftOrRight clickType)
 {
     CampusManager.Instance.DeleteElement((Building)this.Parent);
     this.Parent.Delete();
     base.Clicked(mousePosition, clickType);
 }
Пример #40
0
        /// <summary>
        /// When clicked, we should start the ghosting construction process
        /// </summary>
        /// <param name="mousePosition"></param>
        public override void Clicked(Pair<int> mousePosition, LeftOrRight clickType)
        {
            base.Clicked(mousePosition, clickType);

            if (clickType == LeftOrRight.Left)
            {
                GameScreen.BeginBuilding(this.data.Key);
            }
        }