private void Entrance(string cardId) { if (allCards.Contains(cardId)) { var db1 = new CarCheckerContext(); var userId = db1.Cards.FirstOrDefault(c => c.CardId == cardId).UserId; var user = db1.Users.FirstOrDefault(u => u.Id == userId); KnownUser(cardId); if (!user.InGarage) { if (CheckACar.GetCarSratus(cardId) >= 0) { OpenGate.Open(cardId); } else { errorLabel.Text = "Не уплачено!"; } } else { errorLabel.Text = "Пользователь не выехал из гаража, но пытается вьехать"; } } else { UnknownPerson(); } RemoveAndFocus(); }
private void Open(string cardId) { allCards = db.Cards.Select(c => c.CardId).ToList(); UnknownPerson(); if (allCards.Contains(cardId)) { var db1 = new CarCheckerContext(); var userId = db1.Cards.FirstOrDefault(c => c.CardId == cardId).UserId; var user = db1.Users.FirstOrDefault(u => u.Id == userId); KnownUser(cardId); if (CheckACar.GetCarSratus(cardId) >= 0) { OpenGate.Open(cardId); UserEntrances.Add(cardId); } else { errorLabel.Text = "Не уплачено!"; } //if (user.InGarage) // OpenGate.Open(cardId); //else if (CheckACar.GetCarSratus(cardId) >= 0) // OpenGate.Open(cardId); // else // errorLabel.Text = "Не уплачено!"; } RemoveAndFocus(); }
public void Initialise(int depth) { Depth = depth; for (int i = 0; i < Math.Pow(2, Depth) - 1; i++) { Balls.Add(i + 1); } this.CurrentDepth = 0; this.openGate = (OpenGate)rnd.Next(1, 3); Queue <Branch> branches = new Queue <Branch>(); branches.Enqueue(this); while (branches.Count > 0 && branches.Peek().CurrentDepth < depth) { Branch parent = branches.Dequeue(); parent.Left = this.CreateBranch(parent.CurrentDepth + 1, parent.gateName + "L"); parent.Right = this.CreateBranch(parent.CurrentDepth + 1, parent.gateName + "R"); branches.Enqueue(parent.Left); branches.Enqueue(parent.Right); } //leaf nodes are considered as containers while (branches.Count > 0) { Containers.Add(branches.Dequeue().gateName); } return; }
// Use this for initialization void Start() { instance = this; scollider = scollider.GetComponent <CapsuleCollider>(); scollider.isTrigger = false; //take number of available POIs and set a target number with a certain ratio scrolling.ProgrammOpenGate(out restTarget, out shopTarget, out bankTarget); float r = restTarget * 0.05F; restTarget = (int)r; float s = shopTarget * 0.15F; shopTarget = (int)s; float b = bankTarget * 0.25F; bankTarget = (int)b; GUIManager.SetTarget(restTarget, shopTarget, bankTarget); }
void Update() { CharacterController controller = GetComponent <CharacterController>(); speed = (0.3F * bitCount); yRotation += 2.5F * Input.GetAxis("Horizontal"); transform.eulerAngles = new Vector3(5, yRotation, 0); if (controller.isGrounded) { moveDirection = new Vector3(0.3F * Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; if (Input.GetButton("Jump")) { moveDirection.y = jumpSpeed; float vol = UnityEngine.Random.Range(volLowRange, volHighRange); bit.PlayOneShot(jumpSound, vol); } } moveDirection.y -= gravity * Time.deltaTime; controller.Move(moveDirection * Time.deltaTime); //Give current values to GUIManager GUIManager.SetBoost(bitCount); GUIManager.SetRestaurant(restaurantCount); GUIManager.SetShops(shopCount); GUIManager.SetBanks(bankCount); //Give current values to OpenGate OpenGate.SetOpen(restaurantCount, shopCount, bankCount); //Conditions for Gameover if (bitCount <= 0 || transform.localPosition.y < -10F) { GameEventManager.TriggerGameOver(); SceneManager.LoadScene(GameOverScene, LoadSceneMode.Single); this.enabled = false; routComplete = 0; } }
private void Exit(string cardId) { if (allCards.Contains(cardId)) { var db1 = new CarCheckerContext(); var userId = db1.Cards.FirstOrDefault(c => c.CardId == cardId).UserId; var user = db1.Users.FirstOrDefault(u => u.Id == userId); KnownUser(cardId); if (user.InGarage) { OpenGate.Open(cardId); } else { errorLabel.Text = "Пользователь не вьехал в гараж, но пытается выехать"; } } else { UnknownPerson(); } RemoveAndFocus(); }
private void Awake() { player = FindObjectOfType <Player>().gameObject; openGate = GetComponent <OpenGate>(); }
private void openButton_Click(object sender, EventArgs e) { ByButtonOpen(); OpenGate.OpenToGuest(); }
// Start is called before the first frame update void Start() { openGate = FindObjectOfType <OpenGate>(); openGate.targets.Add(this.gameObject); }