// Start is called before the first frame updte void Awake() { if (instance == null) { instance = this; } }
public IHttpActionResult PutBallCounter(int id, BallCounter ballCounter) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ballCounter.Id) { return(BadRequest()); } db.Entry(ballCounter).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BallCounterExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
void Start() { audioSource = GameObject.Find("AudioSource").GetComponent <AudioSource>(); ballCounter = FindObjectOfType <BallCounter>(); rb = gameObject.GetComponent <Rigidbody>(); rb.useGravity = false; rb.constraints = RigidbodyConstraints.FreezeAll; }
public IHttpActionResult GetBallCounter(int id) { BallCounter ballCounter = db.BallCounters.Find(id); if (ballCounter == null) { return(NotFound()); } return(Ok(ballCounter)); }
public IHttpActionResult PostBallCounter(BallCounter ballCounter) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BallCounters.Add(ballCounter); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = ballCounter.Id }, ballCounter)); }
public IHttpActionResult DeleteBallCounter(int id) { BallCounter ballCounter = db.BallCounters.Find(id); if (ballCounter == null) { return(NotFound()); } db.BallCounters.Remove(ballCounter); db.SaveChanges(); return(Ok(ballCounter)); }
void createBall() { //Debug.Log ("CreateBall.here 0"); GameObject obj = Instantiate(prefab, new Vector3(1, 6, 0), Quaternion.identity) as GameObject; //Debug.Log ("CreateBall.here 1"); Renderer renderer = obj.GetComponentInChildren <Renderer>(); //Debug.Log ("Renderer: " + renderer); int choice = r.Next(1, 5); string materialName = "BallDefault"; if (choice == 1) { materialName = "BallBlue"; } else if (choice == 2) { materialName = "BallGreen"; } else if (choice == 3) { materialName = "BallRed"; } else if (choice == 4) { materialName = "BallYellow"; } //Debug.Log ("materialName: " + materialName); Material newColour = Resources.Load("Materials/" + materialName, typeof(Material)) as Material; var mats = renderer.materials; //Debug.Log ("renderer.materials: " + renderer.materials + " l:"+renderer.materials.Length); //Debug.Log ("newColour: " + newColour); mats[0] = newColour; renderer.materials = mats; BallCounter.add(); //Debug.Log ("material: " + renderer.material); }
void Start() { ballCounter = FindObjectOfType <BallCounter>(); }
void Start() { bc = ballCounter.GetComponent <BallCounter>(); playerStats = GameObject.FindGameObjectWithTag("GameController").GetComponent <PlayerStats>(); }
void Start() { audioSource = GameObject.Find("AudioSource").GetComponent <AudioSource>(); ballCounter = FindObjectOfType <BallCounter>(); }