コード例 #1
0
        public IHttpActionResult PutMoviments(int id, Moviments moviments)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != moviments.Id)
            {
                return(BadRequest());
            }

            db.Entry(moviments).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MovimentsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
 void Start()
 {
     moviments = new Moviments();
     life      = new Life(3);
     sprite    = GetComponent <SpriteRenderer>();
     rigidbody = GetComponent <Rigidbody2D>();
     animator  = GetComponent <Animator>();
 }
コード例 #3
0
 public void Start()
 {
     moviments  = new Moviments();
     life       = new Life(1);
     sprite     = GetComponent <SpriteRenderer>();
     rigidbody  = GetComponent <Rigidbody2D>();
     animator   = GetComponent <Animator>();
     horizontal = 1;
 }
コード例 #4
0
        public IHttpActionResult GetMoviments(int id)
        {
            Moviments moviments = db.Moviments.Find(id);

            if (moviments == null)
            {
                return(NotFound());
            }

            return(Ok(moviments));
        }
コード例 #5
0
        public IHttpActionResult PostMoviments(Moviments moviments)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Moviments.Add(moviments);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = moviments.Id }, moviments));
        }
コード例 #6
0
        public IHttpActionResult DeleteMoviments(int id)
        {
            Moviments moviments = db.Moviments.Find(id);

            if (moviments == null)
            {
                return(NotFound());
            }

            db.Moviments.Remove(moviments);
            db.SaveChanges();

            return(Ok(moviments));
        }
コード例 #7
0
 private void Start()
 {
     move      = GameObject.FindGameObjectWithTag("Mario").GetComponent <IMove>();
     moviments = GameObject.FindGameObjectWithTag("Mario").GetComponent <MarioController>().moviments;
 }