public void BeginChoice(ChoosingInfo choice, Vector3 pos, List <bool> validDirections, Pickup current) { transform.position = pos; // Display correct sprite SetActive(choice); ShowValid(validDirections); anim.SetInteger("CurrentPickup", choice == ChoosingInfo.pickup ? (int)current : -1); }
// Start direction choosing process private bool ChoosingDirection() { // If player is on this beacon, set choosing if (playerContact) { Choosing = ChoosingInfo.direction; } return(choosing != ChoosingInfo.none); }
// Start pickup choosing process private bool ChoosingPickup() { // If player is on this beacon, set choosing if (playerContact) { Choosing = ChoosingInfo.pickup; } return(choosing != ChoosingInfo.none); }
// Set the right sprites to display private void SetActive(ChoosingInfo choice) { if (choice != ChoosingInfo.none) { anim.SetBool("ShowWheel", true); anim.SetBool("PickupSprites", choice == ChoosingInfo.pickup); for (int i = 0; i < animatorAcceptanceParameter.Length; ++i) { anim.SetInteger(animatorAcceptanceParameter[i], 0); } } else { HideChoice(); } }
private List <bool> ValidDirections(ChoosingInfo value) { if (value == ChoosingInfo.direction) { return(new List <bool> { true, true, true, true }); } List <bool> output = new List <bool> { true, false, false, false }; output[1] = BWInventory.Instance.GetPickupCount(Pickup.line) > 0 || pickup == Pickup.line; output[2] = BWInventory.Instance.GetPickupCount(Pickup.area) > 0 || pickup == Pickup.area; output[3] = BWInventory.Instance.GetPickupCount(Pickup.displace) > 0 || pickup == Pickup.displace; return(output); }
// Return true if wheel still open private bool ResolveChoice(Direction dir) { // If choosing pickup to use if (choosing == ChoosingInfo.pickup) { switch (dir) { case Direction.up: Pickup = Pickup.none; break; case Direction.right: Pickup = Pickup.line; break; case Direction.down: Pickup = Pickup.area; break; case Direction.left: Pickup = Pickup.displace; break; default: Pickup = Pickup.none; break; } wheel.MakeChoice(dir, pickupSetSuccessful); if (pickupSetSuccessful) { // End choosing mode Choosing = ChoosingInfo.none; } } // If choosing direction to point else if (choosing == ChoosingInfo.direction) { Direction = dir; wheel.MakeChoice(dir, true); // End choosing mode Choosing = ChoosingInfo.none; } return(choosing != ChoosingInfo.none); }
// Change beacon direction 90 clockwise (via setter) private bool RotateDirection() { // If player isn't on this beacon, return if (!playerContact) { return(false); } // If no choice being made, rotate if (choosing == ChoosingInfo.none) { switch (direction) { case Direction.up: Direction = Direction.right; break; case Direction.right: Direction = Direction.down; break; case Direction.down: Direction = Direction.left; break; case Direction.left: Direction = Direction.up; break; default: Direction = Direction.up; break; } } // If currently choosing direction, cancel else if (choosing == ChoosingInfo.direction) { Choosing = ChoosingInfo.none; } return(choosing != ChoosingInfo.none); }