public async Task <IActionResult> PutDoggo(int id, Doggo doggo) { if (id != doggo.DoggoId) { return(BadRequest()); } doggo.DoggoDateCreated = DateTime.Now; _context.Entry(doggo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoggoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
// Use this for initialization void OnEnable() { agent = GetComponent <NavMeshAgent>(); doggo = GetComponent <Doggo>(); // el doggo está quieto isStationary = false; // se mueve en base a los atributos seteados en unity if (timerForMoveRandom == false) { // Debug.Log("Modo de movimiento seleccionado: CONTROLADO"); timer = timerForMoveAgain; } else // se mueve en base al algoritmo de la class RandomMoving { // Debug.Log("Modo de movimiento seleccionado: ALEATORIO"); moveRadius = 10f; timeMoving = Random.Range(MIN_TIME_MOVING, MAX_TIME_MOVING); timeToStop = Random.Range(MIN_TIME_TO_STOP, MAX_TIME_TO_STOP); timeStationary = Random.Range(MIN_TIME_STATIONARY, MAX_TIME_STATIONARY); timer = timeMoving; } }
public void Put(int id, [FromBody] Doggo doggo) { doggo.DoggoId = id; _db.Entry(doggo).State = EntityState.Modified; _db.SaveChanges(); }
public async Task <ActionResult <Doggo> > PostDoggo(Doggo doggo) { doggo.DoggoDateCreated = DateTime.Now; _context.doggo.Add(doggo); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDoggo", new { id = doggo.DoggoId }, doggo)); }
public static Doggo Add(Doggo doggo) { if (doggoIdMap.ContainsKey(doggo.id)) { Console.WriteLine($"The ID '{doggo.id}' is already belongs to '{Read(doggo.id).name}'!"); return(null); } doggos.Add(doggo); doggoIdMap.Add(doggo.id, doggos.Count - 1); return(doggo); }
public DoggoView(Doggo doggo, bool copyToBuffer = true) { if (copyToBuffer) { Result = doggo.Copy(); } else { Result = doggo; } }
public DoggoDetail(string dbPath, Doggo dog) { _connection = new SQLiteAsyncConnection(dbPath); this.currentdog = dog; // add the binding data to the variable currentdog this.dogId = currentdog.Id; BindingContext = this.currentdog; InitializeComponent(); FavCheck(dogId); }
async void DoggoSelected(object sender, SelectedItemChangedEventArgs e) { this.doggo = ((ListView)sender).SelectedItem as Doggo; if (this.doggo != null) { string targetPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); var dbPath = Path.Combine(targetPath, "DogDBFive.db"); var page = new DoggoDetail(dbPath, doggo); page.BindingContext = this.doggo; // set the binding context for the "DoggoDetail" page await Navigation.PushAsync(page); //navigate to "DoggoDetail" and add the dbPath and the selected doggo } }
public IEnumerator DogWaiting() { Doggo d = FindObjectOfType <Doggo>(); d.transform.position = new Vector3(transform.position.x, transform.position.y - 0.1f, 0f); yield return(new WaitForSeconds(1f)); NextState = KidState.DONE; StartCoroutine(FadeOut(true)); }
public static void Update(int id, Doggo doggo) { if (doggoIdMap.ContainsKey(id)) { Delete(id); Add(doggo); } else { Console.WriteLine($"Invalid Doggo ID '{id}' given!"); } }
IEnumerator SpawnDogCoroutine(string[] dogNames, Character owner) { yield return(new WaitForSeconds(Random.Range( delayBetweenPhoneCallAndSpawnMin, delayBetweenPhoneCallAndSpawnMax))); Doggo[] dogs = new Doggo[dogNames.Length]; for (int i = 0; i < dogNames.Length; i++) { NavMeshHit navHit; NavMesh.SamplePosition( spawnRegion.transform.position, out navHit, 5f, -1); float pitch = gm.GetRandomBarkPitch(); AudioClip barkClip = gm.GetRandomBarkClip(); Doggo dog; Texture[] textures; if (Random.Range(0f, 1f) > 0.5f) { dog = Instantiate(doggoPrefab); textures = doggo1bodyTextures; } else { dog = Instantiate(doggo2Prefab); textures = doggo2bodyTextures; } SkinnedMeshRenderer meshRenderer = dog.GetComponentInChildren <SkinnedMeshRenderer>(); meshRenderer.material.mainTexture = textures[Random.Range(0, textures.Length)]; dog.dogName = dogNames[i]; AudioSource audioSource = dog.GetComponent <AudioSource>(); audioSource.clip = barkClip; audioSource.pitch = pitch; dog.owner = owner; dog.transform.localScale *= Random.Range(0.8f, 1.2f); dog.transform.position = spawnRegion.transform.position; dogs[i] = dog; } timerManager.RegisterDogs(dogs); }
public override void ActionsDuringFadeOut() { Doggo d = FindObjectOfType <Doggo>(); d.gameObject.SetActive(false); Oldman o = FindObjectOfType <Oldman>(); o.EnableDoggo(); laundry.layer = LayerMask.NameToLayer("OnlyMainCameraClickable"); laundryInside.gameObject.SetActive(true); spaceSuit.SetActive(true); doggoGUIButton.SetActive(true); }
public void Interact() { Telephone telephone = interactive.GetComponent <Telephone>(); if (telephone) { telephone.PickupPhone(); } else if (interactive.CompareTag("Ball")) { if (player.grenadeSystem.magazine.CurrentAmmo == player.grenadeSystem.magazine.maxAmmo) { return; } Transform ball = interactive.gameObject.transform; if (ball.parent != null) { Transform parent = ball.transform.parent; if (parent) { Doggo doggo = parent.GetComponentInParent <Doggo>(); doggo.ReturnBall(); } } Destroy(ball.gameObject); player.AddGrenade(); } else if (interactive.CompareTag("FoodSack")) { if (player.CurrentWeaponIsTreatGun()) { player.CurrentEquipedWeapon.AddAmmo(int.MaxValue); player.UpdateWeaponUI(); } } else if (interactive.CompareTag("Door")) { TimerManager tm = FindObjectOfType <TimerManager>(); tm.ResolveClientsAtTheDoor(); } }
public void ResolveClientsAtTheDoor() { messagesPanel.ClearMessages(); for (int i = 0; i < clientsData.Count; i++) { ClientAtTheDoorData catdd = clientsData[i]; StopCoroutine(catdd.doorbellCoroutine); int errors = 0; if (catdd.totalWaitTime > maxAdmittedWaitTime) { errors++; } for (int j = 0; j < clientsData[i].dogs.Length; j++) { Doggo dog = clientsData[i].dogs[j]; if (dog.status.Fullness < dog.status.fullnessCriticValue) { errors++; } if (dog.status.Entertainment < dog.status.entertainmentCriticValue) { errors++; } if (dog.status.Cleanliness < dog.status.cleanlinessCriticValue) { errors++; } } float duration = clientsData.Count > 1 ? fastMsgTimeAtDoor : msgTimeAtDoor; messagesPanel.Enqueue(errors, clientsData[i].dogs, duration); } clientsData.Clear(); }
public IActionResult Delete(int id) { Doggo.Delete(id); return(RedirectToAction("Index")); }
public IActionResult Create(Doggo doggo) { Doggo.Post(doggo); return(RedirectToAction("Index")); }
public IActionResult Edit(int id, Doggo doggo) { doggo.DoggoId = id; Doggo.Put(doggo); return(RedirectToAction("Details", new { id = id })); }
public IActionResult Edit(int id) { var doggo = Doggo.GetDetails(id); return(View("Edit", doggo)); }
private void Start() { meshRenderer = GetComponentInChildren <SkinnedMeshRenderer>(); doggo = GetComponent <Doggo>(); // StartCoroutine(Blink()); }
public override void Fire() { if (!CanFire()) { return; } if (!firing) { audioSource.Play(); } firing = true; magazine.Fire(); muzzleWaterDroplets.Play(); lr.gameObject.SetActive(true); RaycastHit hit; Ray ray = new Ray(muzzle.position, muzzle.forward); float totalDistance; if (Physics.BoxCast( ray.origin, lr.startWidth * muzzle.localScale, ray.direction, out hit, muzzle.rotation, maxDistance, layers, QueryTriggerInteraction.Ignore)) { GameObject go = hit.collider.gameObject; Rigidbody rb = go.GetComponentInParent <Rigidbody>(); if (rb) { Doggo d = go.GetComponentInParent <Doggo>(); if (d) { PhysicsBehaviour pb = d.pb; if (pb && pb.ControlledByAgent) { pb.DisableAgentAndSetupForPhysics(); } d.status.AddBoost(Attributes.CLEANLINESS); } Vector3 force = waterStrengthDistanceCurve.Evaluate(hit.distance / maxDistance) * maxWaterStrength * (-hit.normal + Vector3.up); rb.AddForceAtPosition(force, hit.point); } totalDistance = hit.distance; } else { onHitParticleSystem.Stop(true, ParticleSystemStopBehavior.StopEmitting); totalDistance = maxDistance; } Vector3 dir = ray.direction; lr.positionCount = numberOfSegments; for (int i = 0; i < numberOfSegments; i++) { float perc = i / (float)numberOfSegments; float distance = perc * maxDistance; Vector3 pos = ray.GetPoint(perc * maxDistance); Vector3 beamPos = pos + Random.Range(0.01f, 0.015f) * Mathf.Sin(30 * (i % 2 == 0 ? 1 : -1) * Time.time) * Vector3.up; if (distance >= totalDistance) { lr.positionCount = i; break; } lr.SetPosition(i, beamPos); } onHitParticleSystem.transform.position = lr.GetPosition(lr.positionCount - 1); if (!onHitParticleSystem.isPlaying) { onHitParticleSystem.Play(); } }
public void Post([FromBody] Doggo doggo) { _db.Doggos.Add(doggo); _db.SaveChanges(); }
private void Start() { myTransform = transform; doggo = transform.parent.GetComponentInChildren <Doggo>(); }
// Use this for initialization void Start() { dog = GameObject.Find("Doggo").GetComponent <Doggo>(); scoreText = GetComponent <Text>(); }
public IActionResult Index() { var allDoggos = Doggo.GetDoggos(); return(View(allDoggos)); }
// PuppersController() // { // } public IActionResult Index() { var allPuppers = Doggo.GetAll(); return(View("Index", allPuppers)); }