コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("RodId,Brand,Length,CastWeight")] Rod rod)
        {
            if (id != rod.RodId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rod);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RodExists(rod.RodId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rod));
        }
コード例 #2
0
ファイル: Tools.cs プロジェクト: xiaodelea/GRBLMachinePlugin
        public BallNose(double diameter, double flutelength, double shankdiameter, double totallength)
        {
            if (diameter == 0)
            {
                diameter = GRBLMachinePlugin.Props.DefaultToolDiameter;
            }

            if (shankdiameter == 0)
            {
                shankdiameter = diameter * 0.6;
            }

            if (flutelength == 0)
            {
                flutelength = GRBLMachinePlugin.Props.DefaultToolFluteLength;
            }

            if (totallength == 0)
            {
                totallength = GRBLMachinePlugin.Props.DefaultToolFluteLength;
            }


            double h = diameter / 2;

            // the ball tip
            Surface dome = new Sphere(new Point3F(0, 0, h), diameter / 2, 45, Sphere.Domes.Bottom);
            // the mill body
            Surface flute = new Rod(new Point3F(0, 0, h), diameter / 2, flutelength - h);

            _tool = dome.JoinWith(flute, BuildShank(shankdiameter, diameter, Math.Max(0, totallength - flutelength), flutelength));
        }
コード例 #3
0
ファイル: Rod.cs プロジェクト: yamaharusan/Yukemuri
                public LineManager(Rod parent, Rigidbody rb, ref LineRenderer line, int num)
                {
                    m_parent = parent;

                    m_num = num;

                    m_lineRenderer = line;
                    m_lineRenderer.positionCount = num;

                    //CreateLine(obj);

                    FishingHook = new GameObject().AddComponent <Rigidbody>();
                    FishingHook.gameObject.name = "FishingHook";
                    FishingHook.mass            = 2f;
                    FishingHook.drag            = 1f;
                    FishingHook.angularDrag     = 0f;

                    FishingHookInstance = FishingHook.gameObject.AddComponent <FishingHook>();
                    FishingHookInstance.GetParentRod = m_parent;

                    SpringJoint sj = rb.gameObject.AddComponent <SpringJoint>();

                    Spring = sj;

                    sj.anchor = Vector3.zero;
                    sj.autoConfigureConnectedAnchor = false;
                    sj.connectedAnchor = Vector3.zero;

                    sj.spring      = 1000000f;
                    sj.damper      = 100f;
                    sj.maxDistance = 0f;

                    sj.connectedBody = FishingHook;
                }
コード例 #4
0
 public void LiftDisk(Rod origin)
 {
     //transform.position = new Vector2(transform.position.x, 3.5f);
     StartCoroutine(LerpPosition(new Vector2(transform.position.x, 3.5f), 0.1f));
     origin.Disks.Remove(ID);
     FindObjectOfType <Globals>().Play("LiftDisk");
 }
コード例 #5
0
        private void UpdateRod(Rod rod)
        {
            var index = MyRods.IndexOf(rod);

            MyRods.Remove(rod);
            MyRods.Insert(index, rod);
        }
コード例 #6
0
 void OnMoveDisk(Rod refRod)
 {
     if (!isLifting)
     {
         if (refRod.Disks.Count > 0)
         {
             isLifting = true;
             refDisk   = refRod.Disks.Values[0];
             refDisk.GetComponent <DiskScript>().LiftDisk(refRod);
         }
     }
     else
     {
         if (refRod.Disks.Count > 0 ? refRod.Disks.First().Key > refDisk.GetComponent <DiskScript>().ID : true)
         {
             isLifting = false;
             moveCount++;
             uiManager.ChangeMoveCountText(moveCount.ToString());
             refDisk.GetComponent <DiskScript>().DropDisk(refRod, false);
             if (Rods[2].Disks.Count >= diskCount)
             {
                 uiManager.GameFinished(moveCount.ToString(), CalculateMinimumMoves());
             }
         }
     }
 }
コード例 #7
0
ファイル: Tools.cs プロジェクト: xiaodelea/GRBLMachinePlugin
        public EndMill(double diameter, double flutelength, double shankdiameter, double totallength)
        {
            if (diameter == 0)
            {
                diameter = GRBLMachinePlugin.Props.DefaultToolDiameter;
            }

            if (flutelength == 0)
            {
                flutelength = GRBLMachinePlugin.Props.DefaultToolFluteLength;
            }

            if (shankdiameter == 0)
            {
                shankdiameter = GRBLMachinePlugin.Props.DefaultToolShankDiameter;
            }

            if (totallength == 0)
            {
                totallength = GRBLMachinePlugin.Props.DefaultToolTotalLength;
            }


            Surface flute = new Rod(diameter / 2, flutelength);

            _tool = flute.JoinWith(BuildShank(shankdiameter, diameter, Math.Max(0, totallength - flutelength), flutelength));
        }
コード例 #8
0
ファイル: Base.cs プロジェクト: yamaharusan/Yukemuri
                private void Start()
                {
                    Bone.parent = this;

                    m_fishStatus = GetComponent <FishStatus>();

                    Bone.model.transform.localScale =
                        Bone.model.transform.localScale *
                        (m_fishStatus.getSize() / ((m_fishStatus.maxSize + m_fishStatus.minSize) / 2f));

                    m_rigidBody             = GetComponent <Rigidbody>();
                    m_rigidBody.angularDrag = 10f;

                    if (m_parentHook)
                    {
                        m_parentRod = m_parentHook.GetParentRod;
                    }
                    else
                    {
                        Destroy(gameObject);
                    }

                    m_rod = m_parentHook.GetParentRod;

                    StartCoroutine(C_AI());
                }
コード例 #9
0
ファイル: Tools.cs プロジェクト: xiaodelea/GRBLMachinePlugin
        public Drill(double diameter, double flutelength, double shankdiameter, double totallength)
        {
            if (diameter == 0)
            {
                diameter = GRBLMachinePlugin.Props.DefaultToolDiameter;
            }

            if (shankdiameter == 0)
            {
                shankdiameter = diameter * 0.6;
            }

            if (flutelength == 0)
            {
                flutelength = GRBLMachinePlugin.Props.DefaultToolFluteLength;
            }

            if (totallength == 0)
            {
                totallength = GRBLMachinePlugin.Props.DefaultToolFluteLength;
            }


            double h = Math.Tan(_90rads * ((90f - (90f / 2f)) / 90f)) * (diameter / 2);

            // tip of the drill
            Surface cone = new Rod(new Point3F(0, 0, h), diameter / 2, -h, 1f);      // taper with 1f makes it a cone ;)
            // drill body
            Surface flute = new Rod(new Point3F(0, 0, h), diameter / 2, flutelength - h);

            _tool = cone.JoinWith(flute, BuildShank(shankdiameter, diameter, Math.Max(0, totallength - flutelength), flutelength));
        }
コード例 #10
0
ファイル: Serial.cs プロジェクト: jweather/kneditor
    public static void loadFile()
    {
        string path = FileBrowser.OpenSingleFile("Open File", "", "json");

        if (!File.Exists(path))
        {
            Debug.Log("no such file");
            return;
        }
        string json = File.ReadAllText(path);
        World  w    = JsonUtility.FromJson <World>(json);

        script.the.clearStage();
        foreach (var wn in w.nodes)
        {
            var obj = Node.Create();
            obj.transform.position = wn.position;
            if (script.the.cursor == null)
            {
                script.the.setCursor(obj.gameObject);
            }
        }
        foreach (var wr in w.rods)
        {
            var obj = Rod.Create(wr.size);
            obj.transform.position = wr.position;
            obj.transform.rotation = wr.rotation;
        }
    }
コード例 #11
0
ファイル: Tools.cs プロジェクト: xiaodelea/GRBLMachinePlugin
        public V_Cutter(double diameter, double angle, double shankdiameter, double totaltheight)
        {
            if (shankdiameter == 0)
            {
                shankdiameter = diameter * 0.6;
            }

            if (angle == 0)
            {
                angle = GRBLMachinePlugin.Props.DefaultToolVAngle;
            }


            if (totaltheight == 0)
            {
                totaltheight = GRBLMachinePlugin.Props.DefaultToolFluteLength;
            }


            double h = Math.Tan(_90rads * ((90f - (angle / 2f)) / 90f)) * (shankdiameter / 2);

            Surface cone = new Rod(new Point3F(0, 0, h), shankdiameter / 2, -h, 1f); // taper with 1f makes it a cone ;)

            _tool = cone.JoinWith(BuildShank(shankdiameter, shankdiameter, Math.Max(0, totaltheight - h), h));

            // compensate the V-Cutter's 0.0.0 for the desired cutting diameter
            double dh = Math.Tan(_90rads * ((90f - (angle / 2f)) / 90f)) * (diameter / 2);

            _tool.Transform.Translate(0, 0, -dh);
            _tool.ApplyTransformation();
            _tool.Transform = Matrix4x4F.Identity;

            // an extra circle is drawn at the diameter 0.0.0
            _diameterCircle = new Circle(0, 0, diameter / 2);
        }
コード例 #12
0
    // Use this for initialization
    void Awake()
    {
        if (instance != this && instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }

        rodEnd  = GameObject.Find("RodEnd");
        rodLine = GetComponent <LineRenderer>();
        line    = rodEnd.GetComponent <LineRenderer>();
        rodLine.positionCount = 2;
        line.positionCount    = 2;

        bobberRb = bobber.GetComponent <Rigidbody>();

        bobberStartPos = bobber.transform.position;
        rodEndStartPos = rodEnd.transform.position;

        rodEndPoint    = GameObject.Find("Point 0").GetComponent <BezierPoint>();
        bobberEndPoint = GameObject.Find("Point 1").GetComponent <BezierPoint>();

        lineJoint = bobber.GetComponent <SpringJoint>();

        bezier = bobber.GetComponent <BezierCurve>();

        inputManager = Camera.main.GetComponent <InputManager>();
    }
コード例 #13
0
    public static GameObject Create(int size)
    {
        GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
        Rod        rod = obj.AddComponent <Rod>();

        rod.setSize(size);
        return(obj);
    }
コード例 #14
0
 private void Awake()
 {
     _lineRenderer = GetComponent <LineRenderer>();
     _hook         = GetComponent <Hook>();
     _currentSpeed = _startSpeed;
     _collector    = GetComponent <FishesCollector>();
     _rod          = FindObjectOfType <Rod>();
 }
コード例 #15
0
    protected override void SetupFromSplitJsonString(string[] splitJsonString)
    {
        name       = splitJsonString[0];
        powerLevel = EnumValue.CreateFromJsonString(splitJsonString[1]);
        cost       = Wrapper <float> .CreateFromJsonString(splitJsonString[2]);

        notes = CreateStringFromSafeJson(splitJsonString[3]);
        rod   = Rod.CreateFromJsonString(splitJsonString[4]);
    }
コード例 #16
0
ファイル: Shop.cs プロジェクト: yusiart/Fishing
    private void Start()
    {
        _player = FindObjectOfType <Player>();
        _rod    = FindObjectOfType <Rod>();

        for (int i = 0; i < _hooks.Count; i++)
        {
            AddHook(_hooks[i]);
        }
    }
コード例 #17
0
 void SetupRods()
 {
     for (int i = 0; i < numberRods; i++)
     {
         Rod rod = new Rod(scale);
         rod.gameObject.transform.parent   = gameObject.transform;
         rod.gameObject.transform.position = gameObject.transform.position;
         rods.Add(rod);
     }
 }
コード例 #18
0
    public static void rod(Vector3 a, Vector3 b, Color color, float thickness = 0.01f)
    {
        var p = (a + b) / 2f;
        var r = Quaternion.FromToRotation(Vector3.up, b - a);
        var s = Vector3.one * thickness;

        s.y = (b - a).magnitude;
        var m = Matrix4x4.TRS(p, r, s);

        Rod.Draw(matrix * m, color);
    }
コード例 #19
0
        public async Task <IActionResult> Create([Bind("RodId,Brand,Length,CastWeight")] Rod rod)
        {
            if (ModelState.IsValid)
            {
                _context.Add(rod);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(rod));
        }
コード例 #20
0
    private void Start()
    {
        _rod = FindObjectOfType <Rod>();

        if (PlayerPrefs.HasKey($"price{_number}"))
        {
            price = PlayerPrefs.GetInt($"price{_number}");
        }

        _price.text = price.ToString();
    }
コード例 #21
0
ファイル: Hanoi.cs プロジェクト: voodoo-patch/hanoi-cs
        private void SwapHead(Rod source, Rod destination)
        {
            if (!this.EnsureMove(source, destination))
            {
                throw new InvalidOperationException("Attempted illegal move");
            }

            uint disk = source.Pop();

            destination.Push(disk);
        }
コード例 #22
0
ファイル: MenuToolPanel.cs プロジェクト: dannyray2/PeggleEdit
        private void rodRibbonButton_Click(object sender, EventArgs e)
        {
            UnselectAllTools();
            btnRod.Checked = true;

            Rod rod = new Rod(LevelEditor.Level);

            rod.PointA = new PointF(300, 200);
            rod.PointB = new PointF(400, 250);

            mParent.SetEditorTool(new DrawEditorTool(rod, false));
        }
コード例 #23
0
ファイル: Hanoi.cs プロジェクト: voodoo-patch/hanoi-cs
        private void Solve(uint disks, Rod source, Rod destination, Rod support)
        {
            if (disks == 0)
            {
                return;
            }

            Solve(disks - 1, source, support, destination);

            this.SwapHead(source, destination);

            Solve(disks - 1, support, destination, source);
        }
コード例 #24
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="game">Juego</param>
        /// <param name="objOne">Objeto primero al que está conectado la barra</param>
        /// <param name="relativeContactPointOne">Posición relativa al objeto uno</param>
        /// <param name="objTwo">Objeto segundo al que está conectado la barra</param>
        /// <param name="relativeContactPointTwo">Posición relativa al objeto dos</param>
        /// <param name="size">Longitud de la barra</param>
        public RodComponent(
            Game game,
            IPhysicObject objOne,
            Vector3 relativeContactPointOne,
            IPhysicObject objTwo,
            Vector3 relativeContactPointTwo,
            float size)
            : base(game)
        {
            this.Rod = new Rod(objOne, relativeContactPointOne, objTwo, relativeContactPointTwo, size);

            PolyGenerator.InitializeLine(out this.m_LineVertices, Vector3.Zero, Vector3.One, Color.Red);
        }
コード例 #25
0
        internal void HideorShowRodDetails(Rod rod)
        {
            if (!rod.IsVisible)
            {
                rod.IsVisible = true;
            }
            else
            {
                rod.IsVisible = false;
            }

            UpdateRod(rod);
        }
コード例 #26
0
ファイル: Rod.cs プロジェクト: yamaharusan/Yukemuri
                public RodManager(Rod parent, GameObject obj, int num, Vector3 size, LineRenderer lineRenderer)
                {
                    m_parent = parent;
                    m_size   = size;

                    m_count = num;

                    m_lineRenderer = lineRenderer;

                    obj.layer = LayerMask.NameToLayer(rodLayer);

                    CreateRod(obj, 0, true);
                }
コード例 #27
0
    protected override string ConvertToJsonString(string[] jsonSplitter)
    {
        string jsonString = "";

        jsonString += name + jsonSplitter[0];
        jsonString += EnumValue.GetJsonString(powerLevel) + jsonSplitter[0];
        jsonString += Wrapper <float> .GetJsonString(cost) + jsonSplitter[0];

        jsonString += GetSafeJsonFromString(notes) + jsonSplitter[0];
        jsonString += Rod.GetJsonString(rod) + jsonSplitter[0];

        return(jsonString);
    }
コード例 #28
0
    public void DropDisk(Rod destination, bool initial)
    {
        int diskCount = destination.Disks.Count;

        //position = new Vector2(destination.ID == 0 ? -5.25f : destination.ID == 1 ? 0 : 5.25f, -3 + 0.5f * diskCount);
        //transform.position = position;
        StartCoroutine(LerpPosition(new Vector2(destination.ID == 0 ? -5.25f : destination.ID == 1 ? 0 : 5.25f, -3 + 0.5f * diskCount), 0.1f));

        if (!initial)
        {
            destination.AddDisk(ID, this.gameObject);
            FindObjectOfType <Globals>().Play("DropDisk");
        }
    }
コード例 #29
0
ファイル: RodCooler.cs プロジェクト: dhog10/LD47
    private void OnTriggerExit(Collider other)
    {
        if (other.attachedRigidbody == null)
        {
            return;
        }

        var rod = other.attachedRigidbody.GetComponentInChildren <Rod>();

        if (rod != null && rod == m_Rod)
        {
            m_Rod = null;
            rod.SetCooler(this);
        }
    }
コード例 #30
0
        public decimal ProcessRodsHits(decimal AbsorbedNeutrons)
        {
            decimal TotalEnergy       = 0;
            decimal GeneratedNeutrons = 0;

            foreach (var Rod in ReactorFuelRods)
            {
                Tuple <decimal, decimal> Output = Rod.ProcessRodHit(AbsorbedNeutrons / ReactorFuelRods.Count);
                TotalEnergy       += Output.Item1;
                GeneratedNeutrons += Output.Item2;
            }

            PresentNeutrons = GeneratedNeutrons;

            return(TotalEnergy);
        }
コード例 #31
0
		private void rodRibbonButton_Click(object sender, EventArgs e)
		{
			UnselectAllTools();
			btnRod.Checked = true;

			Rod rod = new Rod(LevelEditor.Level);
			rod.PointA = new PointF(300, 200);
			rod.PointB = new PointF(400, 250);

			mParent.SetEditorTool(new DrawEditorTool(rod, false));
		}
コード例 #32
0
 public void EquipRod(int id)
 {
     fishingRod = GameObject.FindGameObjectWithTag ("RodDatabase").GetComponent<RodDatabase> ().rods [id];
 }