コード例 #1
0
ファイル: Screwdriver.cs プロジェクト: valekkp/Games
        public void Move(Lockpick lockpick, Lock currentLock)
        {
            bool cantMove = false;

            if (lockpick.Angle > currentLock.OuterSectorMin && lockpick.Angle < currentLock.OuterSectorMax)
            {
                if (lockpick.Angle > currentLock.InnerSectorMin && lockpick.Angle < currentLock.InnerSectorMax)
                {
                    if (Angle < 180)
                    {
                        Angle++;
                    }
                    else
                    {
                        cantMove = true;
                    }
                }
                else
                {
                    if (Angle <
                        (180 - Max(lockpick.Angle - currentLock.InnerSectorMax, currentLock.InnerSectorMin - lockpick.Angle)))
                    {
                        Angle++;
                    }
                    else
                    {
                        cantMove = true;
                    }
                }
            }
            else
            {
                cantMove = true;
            }
            if (cantMove)
            {
                lockpick.Durability--;
                lockpick.CurrentColor = Color.DarkRed;
            }
            else
            {
                lockpick.CurrentColor = Color.Green;
            }
            endingLocation = new PointF((float)(startingLocation.X + Length * Cos(Angle * PI / 180)), (float)(startingLocation.Y + Length * Sin(Angle * PI / 180)));
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: valekkp/Games
 public void NewLockpick()
 {
     lockpick = new Lockpick();
 }