public Hardness SwitchHardness(int index)
            {
                var hardness = new Hardness();

                switch (index)
                {
                case 1:
                    hardness.projectionMode  = JointProjectionMode.PositionAndRotation;
                    hardness.projectionAngle = 0.5f; break;

                case 2:
                    hardness.projectionMode  = JointProjectionMode.PositionAndRotation;
                    hardness.projectionAngle = 0; break;

                case 3:
                    hardness.projectionMode     = JointProjectionMode.PositionAndRotation;
                    hardness.projectionAngle    = 10f;
                    hardness.projectionDistance = 5; break;

                case 4:
                    hardness.projectionMode     = JointProjectionMode.PositionAndRotation;
                    hardness.projectionAngle    = 5f;
                    hardness.projectionDistance = 2.5f; break;

                case 5:
                    hardness.projectionMode     = JointProjectionMode.PositionAndRotation;
                    hardness.projectionAngle    = 0f;
                    hardness.projectionDistance = 0; break;

                default:
                    hardness.projectionMode = JointProjectionMode.None; break;
                }
                return(hardness);
            }
예제 #2
0
        public void Delete(int HardnessID)
        {
            Hardness _dbEntry = _context.Hardnesses.Find(HardnessID);

            _dbEntry.Enabled = false;
            _context.SaveChanges();
        }
예제 #3
0
    public override void _Ready()
    {
        _sprite = GetNode <Sprite>("Sprite");

        _hardness = GetRandomHardness();
        SetHardnessTint(_hardness);
    }
 public Pencil(String bodyColor, String drawingColor,
               Double length, Hardness hardness, Type type,
               Material material)
 {
     if (bodyColor == String.Empty || bodyColor == null)
     {
         throw new ArgumentException("String is empty or is not initialized", nameof(bodyColor));
     }
     if (drawingColor == String.Empty || drawingColor == null)
     {
         throw new ArgumentException("String is empty or is not initialized", nameof(drawingColor));
     }
     if (length < 1.0d)
     {
         throw new ArgumentException("Length of pencil cannot be < 1", nameof(drawingColor));
     }
     if (hardness == Hardness.not_defined)
     {
         throw new ArgumentException("Hardness is not defined", nameof(drawingColor));
     }
     if (type == Type.not_defined)
     {
         throw new ArgumentException("Type is not defined", nameof(drawingColor));
     }
     if (material == Material.not_defined)
     {
         throw new ArgumentException("Material is not defined", nameof(drawingColor));
     }
     this.bodyColor    = bodyColor;
     this.drawingColor = drawingColor;
     this.length       = length;
     this.hardness     = hardness;
     this.type         = type;
     this.material     = material;
 }
 public Pencil()
 {
     bodyColor    = null;
     drawingColor = null;
     length       = default;
     hardness     = Hardness.not_defined;
     type         = Type.not_defined;
     material     = Material.not_defined;
 }
예제 #6
0
        public override int GetHashCode()
        {
            int hashCode = -228455935;

            hashCode = hashCode * -1521134295 + Seed.GetHashCode();
            hashCode = hashCode * -1521134295 + Magnitude.GetHashCode();
            hashCode = hashCode * -1521134295 + Hardness.GetHashCode();
            hashCode = hashCode * -1521134295 + Bias.GetHashCode();
            return(hashCode);
        }
예제 #7
0
 public static HardnessModel ToModel(this Hardness aHardnessEntity)
 {
     return(new HardnessModel()
     {
         HardnessId = aHardnessEntity.HardnessId,
         ShortName = aHardnessEntity.ShortName,
         Description = aHardnessEntity.Description,
         HardnessMin = aHardnessEntity.HardnessMin,
         HardnessMax = aHardnessEntity.HardnessMax
     });
 }
예제 #8
0
 public MaterialHardness(Material Material, Hardness Hardness)
 {
     MaterialID   = Material.MaterialID;
     MaterialName = Material.Name;
     if (Hardness != null)
     {
         HardnessID   = Hardness.HardnessID;
         HardnessName = Hardness.Value;
         FullValue    = MaterialName + "@" + HardnessName;
     }
     else
     {
         HardnessID   = 0;
         HardnessName = "";
         FullValue    = MaterialName + "@";
     }
 }
예제 #9
0
    private void SetHardnessTint(Hardness hardness)
    {
        switch (hardness)
        {
        case Hardness.Light:
            _sprite.Modulate = _lightColor;
            break;

        case Hardness.Medium:
            _sprite.Modulate = _mediumColor;
            break;

        case Hardness.Hard:
            _sprite.Modulate = _hardColor;
            break;
        }
    }
예제 #10
0
        public override void OnSimulateStartAlways()
        {
            if (EnhancementEnabled)
            {
                ConfigurableJoint = GetComponent <ConfigurableJoint>();
                hardness          = new Hardness(ConfigurableJoint);

                StartCoroutine(wait());
            }

            IEnumerator wait()
            {
                var orginPos = Vector3.zero;

                if (sliderBlock.jointTrigger != null)
                {
                    orginPos = sliderBlock.jointTrigger.position;
                }
                yield return(new WaitUntil(() => ConfigurableJoint.connectedBody != null));

                //if (!EnhancementEnabled)
                //{
                //    Limit = orginLimit;
                //    HardnessIndex = orginHardnessIndex;
                //}
                if (lockToggle.IsActive)
                {
                    ConfigurableJoint.xMotion = ConfigurableJointMotion.Locked;
                }
                else
                {
                    ConfigurableJoint.autoConfigureConnectedAnchor = false;
                    //ConfigurableJoint.connectedAnchor -= transform.forward * extendSlider.Value;
                    ConfigurableJoint.connectedAnchor = ConfigurableJoint.connectedBody.transform.InverseTransformPoint(orginPos);
                }

                SoftJointLimit limit = ConfigurableJoint.linearLimit;

                limit.limit = /*Limit =*/ Mathf.Abs(/*Limit*/ limitSlider.Value);
                ConfigurableJoint.linearLimit = limit;

                hardness.SwitchWoodHardness(/*HardnessIndex*/ HardnessMenu.Value, ConfigurableJoint);
                yield break;
            }
        }
예제 #11
0
 public int Save(Hardness Hardness)
 {
     if (Hardness.HardnessID == 0)
     {
         _context.Hardnesses.Add(Hardness);
     }
     else
     {
         Hardness _dbEntry = _context.Hardnesses.Find(Hardness.HardnessID);
         if (_dbEntry != null)
         {
             _dbEntry.Value      = Hardness.Value;
             _dbEntry.MaterialID = Hardness.MaterialID;
             _dbEntry.Enabled    = Hardness.Enabled;
         }
     }
     _context.SaveChanges();
     return(Hardness.HardnessID);
 }
예제 #12
0
 public string[] GetData()
 {
     return(new string[] { Name, Starts.ToString(), Wins.ToString(), AlmostWins.ToString(), Loses.ToString(), Hardness.ToString() + "%", EmotionFactor.ToString() + "%" });
 }
예제 #13
0
        public int SaveHardness(Hardness Hardness)
        {
            int _hardnessID = _hardnessRepository.Save(Hardness);

            return(_hardnessID);
        }