//To Do Fix please public void Squeeze(int power)//please { squeezePower = power; if (targetObject != null) { if (power < targetObject.minPressure) { if (holdingObject != null) { //Debug.Log("DO YOU EVEN WORK?!"); LetGo(); } } else if (power > targetObject.maxPressure) { if (holdingObject != null) { Destroy(holdingObject.gameObject); //Destroy(holdingObject); holdingObject = null; isHoldingObject = false; } } else { Grab(); } } }
void ProcessPickup(PickUps id) { switch (id) { case PickUps.Shield: AddShield(); break; case PickUps.Bomb: //numBombs = Mathf.Clamp(numBombs + 1, 0, 5); gameManager.AddBomb(); break; case PickUps.LifeUp: lives = Mathf.Clamp(lives++, 0, 5); gameManager.AddLife(); break; case PickUps.SpreadShot: hasSpreadShot = true; currSpreadShotTime = 0f; currWeapon = WeaponType.Spread; break; case PickUps.RegularShot: hasSpreadShot = false; currSpreadShotTime = 0f; currWeapon = WeaponType.Regular; break; } }
public void MultiplicationOn() { foreach (var PickUps in Player.GameObjectsinView) { PickUps.GetComponent <PickUps>().Value = MultiplyFactor; } }
public ActionResult Edit([Bind(Include = "StreetAddress,Zipcode,CustomerId,PickUpId,PickUpDay,StartDate,EndDate,Recurring,Completed")] PickUps pickUps) { string currentUserId = User.Identity.GetUserId(); if (ModelState.IsValid) { //CustomerUsers currentCustomer = db.CustomerUsers.Where(c => c.CustomerId == pickUps.CustomerId).First(); DateTime getPickUpDate = GetNextWeekday(pickUps.StartDate, pickUps.PickUpDay); PickUps originalPickUp = db.PickUps.Where(c => c.PickUpId == pickUps.PickUpId).First(); pickUps.PickUpDate = getPickUpDate; pickUps.CustomerId = originalPickUp.CustomerId; pickUps.Zipcode = originalPickUp.Zipcode; pickUps.StreetAddress = originalPickUp.StreetAddress; db.Entry(originalPickUp).State = EntityState.Detached; db.Entry(pickUps).State = EntityState.Modified; db.SaveChanges(); if (pickUps.Completed == true) { return(RedirectToAction("Create", "Billings", pickUps)); } else if (pickUps.Completed == false) { return(RedirectToAction("Index", "PickUps", db.PickUps.ToList())); } } return(View(pickUps)); }
internal void GeneratePickUp(Vector2 position_) { float pickupSizeDraw = 0.005f; float pickupSizeColl = pickupSizeDraw; float pickupVelocity = 0.8f; float pickupHitpoints = 100f; if ((Score % 2) == 0) { Vector2 ranDir = new Vector2((float)rng.NextDouble() * 0.02f - 0.01f, (float)rng.NextDouble() * 0.02f - 0.01f); PickUps.Add(new PickUp(position_ + ranDir, pickupSizeDraw, pickupSizeDraw, pickupVelocity, pickupHitpoints, GameObjects.Count, 0)); } if ((Score % 3) == 0) { Vector2 ranDir = new Vector2((float)rng.NextDouble() * 0.02f - 0.01f, (float)rng.NextDouble() * 0.02f - 0.01f); PickUps.Add(new PickUp(position_ + ranDir, pickupSizeDraw, pickupSizeDraw, pickupVelocity, pickupHitpoints, GameObjects.Count, 1)); } if ((Score % 5) == 0) { Vector2 ranDir = new Vector2((float)rng.NextDouble() * 0.02f - 0.01f, (float)rng.NextDouble() * 0.02f - 0.01f); PickUps.Add(new PickUp(position_ + ranDir, pickupSizeDraw, pickupSizeDraw, pickupVelocity, pickupHitpoints, GameObjects.Count, 2)); } if ((Score % 20) == 0) { Vector2 ranDir = new Vector2((float)rng.NextDouble() * 0.02f - 0.01f, (float)rng.NextDouble() * 0.02f - 0.01f); PickUps.Add(new PickUp(position_ + ranDir, pickupSizeDraw, pickupSizeDraw, pickupVelocity, pickupHitpoints, GameObjects.Count, 3)); } if ((Score % 50) == 0) { Vector2 ranDir = new Vector2((float)rng.NextDouble() * 0.02f - 0.01f, (float)rng.NextDouble() * 0.02f - 0.01f); PickUps.Add(new PickUp(position_ + ranDir, pickupSizeDraw, pickupSizeDraw, pickupVelocity, pickupHitpoints, GameObjects.Count, 4)); } Console.WriteLine("Pickup " + this.GameObjects.Count + ". erzeugt."); }
public ActionResult DeleteConfirmed(int id) { PickUps pickUps = db.PickUps.Find(id); db.PickUps.Remove(pickUps); db.SaveChanges(); return(RedirectToAction("Index")); }
public void RemoveItem(PickUps item) { if (inventory.Contains(item)) { inventory.Remove(item); Updateicons(); } }
private void OnTriggerEnter2D(Collider2D other) { //do different damage to other game objects depend on their tag if (other.tag == "Player") { PlayerController player = other.GetComponent <PlayerController>(); if (!player.isDamaged) { SoundManager.instance.PlayDamaged(); PlayerController.currentHP--; player.isDamaged = true; } } if (other.tag == "SoftBlock") { Blocks block = other.GetComponent <Blocks>(); if (!block.isDamaged) { block.currentHP -= exDamage; } } if (other.tag == "HardBlock") { Blocks block = other.GetComponent <Blocks>(); if (!block.isDamaged && bombTypeP) { block.currentHP -= exDamage; } else if (!block.isDamaged && !bombTypeP) { block.currentHP -= 0; } } if (this.tag == "Explosion") { if (other.tag == "EnemyDamage") { Enemy enemy = other.GetComponentInParent <Enemy>(); if (!enemy.isDamaged) { enemy.currentHP -= exDamage; enemy.isDamaged = true; } } } if (other.tag == "PickUps") { PickUps pickup = other.GetComponent <PickUps>(); if (!pickup.isInvincible) { Destroy(other.gameObject); } } }
// Use this for initialization. Set essential values of certain variables. void Start() { isStarted = false; isPaused = false; asc = GetComponent <AudioSource> (); lh = GetComponent <LevelHandler> (); songSelectorScript = GetComponent <songSelecter> (); pickUpsScript = songSelectorScript.getPickUpScript(); }
public bool AddItem(PickUps item) { if (inventory.Count + 1 <= maxSpace) { inventory.Add(item); Updateicons(); return(true); } return(false); }
public void AddPickUpState(PickUpObject pickup) { PickupState pickupState = new PickupState() { ID = pickup.ID, active = true }; PickUps.Add(pickupState); }
// GET: Billings/Create public ActionResult Create(PickUps pickUp) { ViewBag.CustomerId = pickUp.CustomerId; //new SelectList(db.CustomerUsers, "CustomerId", "UserId"); ViewBag.PickUpId = pickUp.PickUpId; //new SelectList(db.PickUps, "PickUpId", "StreetAddress"); ViewBag.Fee = 35.00; ViewBag.PickUpDate = pickUp.PickUpDate; ViewBag.CustFirstName = db.CustomerUsers.Where(c => c.CustomerId == pickUp.CustomerId).First().FirstName; ViewBag.CustLastName = db.CustomerUsers.Where(c => c.CustomerId == pickUp.CustomerId).First().LastName; return(View()); }
public ActionResult Edit([Bind(Include = "PickUpId,PickCustomerId,DayOfWeek,PickUpDate,Cost,Zipcode,SuspendPickUpStart,SuspendPickUpEnd")] PickUps pickUps) { if (ModelState.IsValid) { db.Entry(pickUps).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pickUps)); }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
public ActionResult DeleteConfirmed(int id) { PickUps pickUps = db.PickUps.Find(id); Customer customer = db.Customers.Where(c => c.PickId == pickUps.PickUpId).Single(); customer.AccountBalance = pickUps.Cost; pickUps.Cost = 75; pickUps.PickUpDate = null; db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: PickUps/Create public ActionResult Create(int?customerId, PickUps lastPickUp = null) { if (lastPickUp != null) { if (lastPickUp.Recurring == true && lastPickUp.EndDate.Date > DateTime.Today.Date) { return(RedirectToAction("CreateRecurring", lastPickUp)); } } return(View()); }
public ActionResult Edit([Bind(Include = "PickUpId,PickUpDate,Cost,CustomerId")] PickUps pickUps) { if (ModelState.IsValid) { db.Entry(pickUps).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerId = new SelectList(db.Customers, "Id", "FirstName", pickUps.PickUpId); return(View(pickUps)); }
public void LetGo() { if (holdingObject != null) { holdingObject.isGrounded = false; holdingObject.rigidbody.isKinematic = false; holdingObject.transform.parent = null; holdingObject.rigidbody.useGravity = true;//Just to be sure holdingObject = null; isHoldingObject = false; } }
private void CheckEnterField(UserControl control, double afterY, double afterX, double beforeY, double beforeX) { if (control is CoinControl coin) { Coins++; this.coinCount.Content = Coins.ToString(); canvas.Children.Remove(coin); } else if (control is KeyControl key) { int keyy = (int)(afterY - 1.0) / 20; int keyx = (int)(afterX - 1.0) / 10; Key collectkey = PickUps.PickupKey(keyx, keyy, keys) as Key; ownedKeys.Add(collectkey); Keys++; this.keyCount.Content = Keys.ToString(); canvas.Children.Remove(key); } else if (control is DoorControl door) { int doory = (int)(afterY - 1.0) / 20; int doorx = (int)(afterX - 1.0) / 10; if (!PickUps.unlockTheDoor(doorx, doory, doors, ownedKeys)) { Keys--; keyCount.Content = Keys.ToString(); canvas.Children.Remove(door); } else { player.SetValue(Canvas.TopProperty, beforeY); player.SetValue(Canvas.LeftProperty, beforeX); } } else if (control is EscapeDoor escape) { if (Coins == coins.Count) { MainWindow window = (MainWindow)Application.Current.Windows.OfType <Window>().SingleOrDefault(w => w.IsActive); window.KeyDown -= CanvasKeyPreview; window.Content = new EscapePg(); } else { player.SetValue(Canvas.TopProperty, beforeY); player.SetValue(Canvas.LeftProperty, beforeX); } } }
public void OnExplosion() { Vector3 pickupPos = new Vector3(transform.position.x, transform.position.y, transform.position.z); rand = Random.Range(0.0f, 60.0f); if (rand <= 10.0f) { PickUps pickup = Instantiate(range, pickupPos, Quaternion.identity) as PickUps; if (pickup != null) { pickup.row = this.row; pickup.col = this.col; pickup.sm = this.sm; pickup.bm = this.bm; pickup.pickupRange = true; pickup.pickupLimit = false; pickup.pickupSpeed = false; } } if (rand <= 20.0f && rand > 10.0f) { PickUps pickup = Instantiate(limit, pickupPos, Quaternion.identity) as PickUps; if (pickup != null) { pickup.row = this.row; pickup.col = this.col; pickup.sm = this.sm; pickup.bm = this.bm; pickup.pickupRange = false; pickup.pickupLimit = true; pickup.pickupSpeed = false; } } if (rand <= 30.0f && rand > 20.0f) { PickUps pickup = Instantiate(speed, pickupPos, Quaternion.identity) as PickUps; if (pickup != null) { pickup.row = this.row; pickup.col = this.col; pickup.sm = this.sm; pickup.bm = this.bm; pickup.pickupRange = false; pickup.pickupLimit = false; pickup.pickupSpeed = true; } } DestroyObject(gameObject); }
// GET: PickUps/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PickUps pickUps = db.PickUps.Find(id); if (pickUps == null) { return(HttpNotFound()); } return(View(pickUps)); }
public void SpawnPickUps() { int randomItem = Random.Range(0, usablePickUps.Count); PickUps toSpawn = usablePickUps[randomItem]; Vector3 pickUpsPosition = new Vector3(Random.Range(-0.4f, -0.4f + maplength), Random.Range(-4.35f, -4.35f + maplength), -1f); Instantiate(toSpawn, pickUpsPosition, Quaternion.identity); if (stopSpawning) { CancelInvoke("SpawnPickUps"); } }
// GET: PickUps/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PickUps pickUps = db.PickUps.Find(id); if (pickUps == null) { return(HttpNotFound()); } // ViewBag.CustomerId = new SelectList(db.Customers, "Id", "FirstName", pickUps.CustomerId); return(View(pickUps)); }
public ActionResult Create(PickUps pickUps, string Month, string Date, string DayOfWeek) { Customer customer = db.Customer.Where(c => c.UserName == User.Identity.Name).SingleOrDefault(); var pickup = db.PickUps.Where(p => p.PickUpId == customer.PickId).Single(); pickup.PickUpDate = new DateTime(2018, int.Parse(Month), int.Parse(Date)); pickup.Cost += 50; if (ModelState.IsValid) { db.SaveChanges(); return(RedirectToAction("Details", "Customers")); } return(View(pickUps)); }
public ActionResult Create(PickUps pickUps) { try { var user = User.Identity.GetUserId(); var customer = db.Customers.Where(c => c.ApplicationUserId == user).Single(); pickUps.CustomerId = customer.Id; db.PickUps.Add(pickUps); db.SaveChanges(); return(RedirectToAction("Details", "Customer")); } catch { return(View()); } }
private static bool CheckValidMove(int X, int Y, List <Key> ownedKeys, List <Key> keys, List <Door> doors, List <Coin> coins, ref object CoinLock, ref int points, List <LinkedList <IField> > readmap) { if (PickUps.PickUpCoin(X, Y, coins, ref CoinLock) == 1) { ++points; lock (CoinLock) { Console.ForegroundColor = ConsoleColor.White; Cursor.WriteString(readmap[0].Count + 11, 1, points.ToString()); } } else { IPickup mapKey = PickUps.PickupKey(X, Y, keys); if (mapKey != null) { ownedKeys.Add(mapKey as Key); lock (CoinLock) { Console.ForegroundColor = ConsoleColor.White; Cursor.WriteString(readmap[0].Count + 11, 2, ownedKeys.Count.ToString()); } } else { bool status = PickUps.unlockTheDoor(X, Y, doors, ownedKeys); if (status == true) { return(false); } else { lock (CoinLock) { Console.ForegroundColor = ConsoleColor.White; Cursor.WriteString(readmap[0].Count + 11, 2, ownedKeys.Count.ToString() + " "); } } } } return(true); }
//Move the grabber Up and down using pressure public void MovePressure(float speed) { RaycastHit hit; Ray ray = new Ray(transform.position, -transform.up); //Ray down from this object. if (Physics.Raycast(ray, out hit, 50)) //Raycast with a distance of 50. We also get to know what we hit { PickUps pickUp = hit.collider.gameObject.GetComponent <PickUps>(); //Do we hit a pickup? float targetHeight = hit.point.y + 0.5f; //(EUtils.GetObjectUnitSize(this.gameObject).y / 2); //move down if ((transform.position.y > targetHeight && speed < 0)) { transform.Translate(0, speed * Time.deltaTime, 0);//Go down isUp = false; } //move up //are we below the start position and is the pressure above 0? if ((transform.position.y < startHeight && speed > 0)) { // Debug.Log(speed); transform.Translate(0, speed * Time.deltaTime, 0);//go up. isDown = false; } //Grabbing time float distanceDown = Mathf.Abs(transform.position.y - targetHeight); float distanceUp = Mathf.Abs(transform.position.y - startHeight); if (distanceDown < 0.1f) { if (pickUp != null) { if (pickUp.isGrounded) { //Grab(); //Grab(pickUp); isDown = true; Grab(); } } } else if (distanceUp < 0.1f) { // isDown = false; isUp = true; } } }
public void MoveDown(float speed, bool autoGrab = true) { if (!isDown && !isHoldingObject) //We can't go down if we are down? { RaycastHit hit; //What do we hit? Ray ray = new Ray(transform.position, -transform.up); //Ray down from this object. if (Physics.Raycast(ray, out hit, 50)) //Raycast with a distance of 50. We also get to know what we hit { PickUps pickUp = hit.collider.gameObject.GetComponent <PickUps>(); //Do we hit a pickup? if (pickUp != null) //yes we do then { float targetHeight = hit.point.y + 0.5f; if (pickUp.isGrounded) { Vector3 targetPosition = new Vector3(transform.position.x, targetHeight, transform.position.z); if (transform.position != targetPosition) { isUp = false; isGoingUp = false; transform.position = Vector3.MoveTowards(transform.position, targetPosition, speed * Time.deltaTime); } else { isDown = true; if (autoGrab) { Grab(); } else { targetObject = pickUp;//target } } } } /* * else * { * if(autoGrab) * isDown = true; * } */ } } }
void OnTriggerEnter(Collider collider) { PickUps pickUp = collider.gameObject.GetComponent <PickUps>(); if (pickUp != null) { if (destroyWholeObject) { Destroy(pickUp.gameObject); } else { Destroy(pickUp); } GameValues.HANGAR.Score++; } }
public ActionResult Create(PickUps pickUps, string Month, string Date, string DayOfWeek) { var customer = db.Customers.Where(c => c.UserName == User.Identity.Name).SingleOrDefault(); var pickupObject = db.PickUps.Where(p => p.PickUpId == customer.PickId).Single(); pickupObject.PickUpDate = new DateTime(2018, int.Parse(Month), int.Parse(Date)); pickupObject.Cost += 25; //pickUps.PickUpDate = new DateTime(2018, int.Parse(Month), int.Parse(Date)); //pickUps.PickCustomerId = customer.Id; //pickUps.Cost = 25; //pickUps.Zipcode = customer.Address.Zipcode; if (ModelState.IsValid) { db.SaveChanges(); return(RedirectToAction("Details", "Customers", new { id = customer.Id })); } //ViewBag.CustomerId = new SelectList(db.Customers, "Id", "FirstName", pickUps.CustomerId); return(View(pickUps)); }