public ActionResult DeleteConfirmed(int id)
        {
            Recovering recovering = db.recoverings.Find(id);

            db.recoverings.Remove(recovering);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "RecoveringId,PeoplesId")] Recovering recovering)
 {
     if (ModelState.IsValid)
     {
         db.Entry(recovering).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(recovering));
 }
        public ActionResult Create([Bind(Include = "RecoveringId,PeoplesId")] Recovering recovering)
        {
            if (ModelState.IsValid)
            {
                db.recoverings.Add(recovering);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(recovering));
        }
        // GET: Recoverings/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Recovering recovering = db.recoverings.Find(id);

            if (recovering == null)
            {
                return(HttpNotFound());
            }
            return(View(recovering));
        }
Beispiel #5
0
    private void Awake()
    {
        inputAction = new InputActions();
        inputAction.PlayerControls.Move.performed += ctx => movementInput = ctx.ReadValue <Vector2>();
        cf  = GetComponent <ConfigurableJoint>();
        jtd = GetComponent <JointTargetDisabler>();
        //inputAction.PlayerControls.Tackle.performed += ctx => tackle = ctx.ReadValue<float>();

        //set joint drive values
        jd  = new JointDrive();
        jd0 = new JointDrive();
        jd.positionSpring     = 10000;
        jd.positionDamper     = 200;
        jd.maximumForce       = 10000;
        jd0.positionDamper    = 0;
        jd0.positionSpring    = 0;
        jd0.maximumForce      = 0;
        jdGrad.positionDamper = 200;
        jdGrad.positionSpring = 10000;
        jdGrad.maximumForce   = 10000;
        myCollider            = GetComponent <Collider>();
        myRigidbody           = GetComponent <Rigidbody>();

        //disable collisions with controller collider and self
        foreach (Collider d in gameObject.GetComponentsInChildren <Collider>())
        {
            Physics.IgnoreCollision(myCollider, d);
        }

        camera          = GameObject.FindGameObjectWithTag("MainCamera");
        stateMachine    = new StateMachine();
        standingUpState = gameObject.AddComponent <StandingUp>();
        standingUpState.Initialize(this, stateMachine, "StandingUp");
        idleState = gameObject.AddComponent <Idle>();
        idleState.Initialize(this, stateMachine, "Idle");
        tacklingState = gameObject.AddComponent <Tackling>();
        tacklingState.Initialize(this, stateMachine, "Tackling");
        recoveringState = gameObject.AddComponent <Recovering>();;
        recoveringState.Initialize(this, stateMachine, "Recovering");
        movingState = gameObject.AddComponent <Moving>();;
        movingState.Initialize(this, stateMachine, "Moving");
        fallenState = gameObject.AddComponent <Fallen>();
        fallenState.Initialize(this, stateMachine, "Fallen");
        stateMachine.Initialize(idleState);
    }
Beispiel #6
0
 /// <summary>
 /// Add an exhausted worker to the Recovery
 /// </summary>
 /// <param name="wk"></param>
 public void AddToRecoveryIfNeedsRest(Citizen wk) => Perform(wk.NeedsRest, () => Recovering.Add(wk));
Beispiel #7
0
 /// <summary>
 /// Remove a rested worker from the Recovery
 /// </summary>
 /// <param name="wk"></param>
 public void RemoveFromRecoveryIfRested(Citizen wk) => Perform(wk.IsRested, () => Recovering.Remove(wk));