IEnumerator ChangingInfo(bool hide) { //Animation zur Anzeige der Info: startField.gameObject.SetActive(true); infoField.gameObject.SetActive(true); CanvasGroup startGroup = startField.GetComponent <CanvasGroup>(); CanvasGroup infoGroup = infoField.GetComponent <CanvasGroup>(); startGroup.alpha = hide ? 0 : 1; infoGroup.alpha = 1 - startGroup.alpha; float timeStep = 2 * Time.fixedDeltaTime; float startStep = hide ? timeStep : -timeStep; float infoStep = -startStep; for (float count = 0; count < 1; count += timeStep) { startGroup.alpha += startStep; infoGroup.alpha += infoStep; yield return(new WaitForFixedUpdate()); } startField.gameObject.SetActive(hide); infoField.gameObject.SetActive(!hide); if (hide) { HoldButton.UnlockAll(); } }
private void WallJuming() { if (!aplication.playerModel.OnFloor && !aplication.wall.DragOnWall(OnceButton.GetButtonStatus()) && aplication.playerModel.OnRightWall && !aplication.playerModel.Dash) { aplication.slide.PlayerSlide(aplication.playerModel.horizontal); if (HoldButton.GetButtonStatusDown(ButtonCode.JumpButton)) { powerWallJump = aplication.playerModel.SlideWall ? Math.Sqrt(aplication.playerModel.powerWallJump) : aplication.playerModel.powerWallJump; aplication.playerModel.JumpWall = true; Invoke(nameof(StopWallJump), aplication.playerModel.timeWallJump); aplication.direction.diractionPlayer(-transform.localScale.x, transform.localScale); } } else { aplication.playerModel.SlideWall = false; } if (aplication.playerModel.JumpWall) { var diraction = aplication.playerModel.SlideWall ? -aplication.playerModel.horizontalRaw : -hit.normal.x; aplication.jumpWall.Jump(new Vector2((float)powerWallJump, (float)Math.Sqrt(powerWallJump)), diraction, false); } }
void Update() { OnPoint = Physics2D.OverlapBox(transform.position, size, 1f, mask); if (HoldButton.GetButtonStatus(ButtonCode.InteractionButton) && OnPoint) { SaveOnPoint(OnPoint, gameObject.name, ModuleDB.coordinateTable.Name, transform.position); scene.Loading(sceneName); } }
public void Jump() { if (!aplication.wall.DragOnWall(OnceButton.GetButtonStatus()) && !aplication.playerModel.JumpWall && !aplication.playerModel.Dash) { aplication.jump.Jump(new Vector2(aplication._Body.velocity.x, aplication.playerModel.standartJumpPower), 0f, HoldButton.GetButtonStatusDown(ButtonCode.JumpButton)); aplication.jump.SetGravity(HoldButton.GetButtonStatus(ButtonCode.JumpButton)); aplication.playerModel.Jump = aplication._Body.velocity.y != 0 && !aplication.playerModel.OnFloor ? true : false; } }
public override void InitAbility(GameObject player) { base.InitAbility(player); AddEvent(); dashButton = ObjectReferences.instance.dashButton; movementInput = ObjectReferences.instance.movementInput; playerRB = player.GetComponent <Rigidbody2D>(); playerMovement = player.GetComponent <PlayerMovement>(); playerAnimator = player.GetComponent <Animator>(); defaultGravity = playerMovement.DefaultGravity; }
private void Dash() { if (aplication.playerModel.DashingTime) { if (HoldButton.GetButtonStatus(ButtonCode.DashButton)) { StartCoroutine(aplication.dash.Dash(new Vector2(aplication.playerModel.horizontalRaw, aplication.playerModel.verticalRaw))); } } if (OnDashingStateChange != null) { OnDashingStateChange(aplication.dash.dashState != DashState.StartDashing); } }
private void WallHangJump() { if (HoldButton.GetButtonStatusDown(ButtonCode.JumpButton) && aplication.wall.DragOnWall(OnceButton.GetButtonStatus()) && !aplication.playerModel.Dash) { aplication.playerModel.JumpHangWall = true; Invoke(nameof(StopWallHangJump), aplication.playerModel.timeWallHangJump); } if (aplication.playerModel.JumpHangWall) { aplication.jumpWall.Jump(new Vector2((float)aplication.playerModel.powerWallHangJump * 1.8f, (float)Math.Abs(aplication.playerModel.powerWallHangJump)), aplication.playerModel.horizontalRaw, false); } }
private bool forceGravity = false; /// < Set this to true if you wish to manually set the player's gravity scale private void Start() { rb = GetComponent <Rigidbody2D>(); collider = GetComponent <Collider2D>(); playerColor = GetComponent <PlayerColor>(); sr = GetComponent <SpriteRenderer>(); ani = GetComponent <Animator>(); input = ObjectReferences.instance.movementInput; jumpButton = ObjectReferences.instance.jumpButton; dashButton = ObjectReferences.instance.dashButton; defaultGravity = rb.gravityScale; }
// Change the value of the option depending of the incremental value of the button private void OnValueChanged(HoldButton button) { Transform parent = button.gameObject.transform.parent; m_mapOptions[parent.name] += button.IncrementalValue; if (m_mapOptions[parent.name] < 0) { m_mapOptions[parent.name] = 0; } else { parent.Find("Value").GetComponent <TextMeshProUGUI>().text = m_mapOptions[parent.name].ToString(); } }
private void Start() { // Dictionary that contains the name of the option to configure associated with its value m_mapOptions = new Dictionary <string, int> { { "Map width", m_mapWidth }, { "Map height", m_mapHeight }, { "Max room amount", m_maxRoomAmount }, { "Max shortcut amount", m_maxShortcutAmount }, { "Min room length", m_minRoomLength }, { "Max room length", m_maxRoomLength }, { "Min tunnel length", m_minTunnelLength }, { "Max tunnel length", m_maxTunnelLength }, { "Tunnel width", m_tunnelWidth }, { "Breakable tunnel chance", m_breakableTunnelChance }, { "Shortcut min skip distance", m_shortcutMinSkipDistance }, { "Reflector area size", m_reflectorAreaSize } }; foreach (KeyValuePair <string, int> mapOption in m_mapOptions) { // Create one "Option Item" per element defined in the mapOptions dictionary GameObject optionItem = Instantiate(m_optionItemPrefab, m_optionList.transform); optionItem.transform.localScale = Vector3.one; optionItem.name = mapOption.Key; // Set the name of the option in the "Option List" TextMeshProUGUI optionNameText = optionItem.transform.Find("Name").GetComponent <TextMeshProUGUI>(); optionNameText.text = mapOption.Key; // Set the default value of the option in the "Option List" TextMeshProUGUI optionValue = optionItem.transform.Find("Value").GetComponent <TextMeshProUGUI>(); optionValue.text = mapOption.Value.ToString(); // Add the possibility to increase the value of the option HoldButton buttonUp = optionItem.transform.Find("ButtonUp").GetComponent <HoldButton>(); buttonUp.OnValueChanged += OnValueChanged; // Add the possibility to decrease the value of the option HoldButton buttonDown = optionItem.transform.Find("ButtonDown").GetComponent <HoldButton>(); buttonDown.OnValueChanged += OnValueChanged; } }
protected override IEnumerator ChangeTutorial(bool active) { group.alpha = active ? 0 : 1; IceStandScript.stopTimer = active; if (active) { HoldButton.LockAll(); } yield return(new WaitForSeconds(.1f)); for (float count = 0; count < 1; count += timeStep) { group.alpha = active ? count : 1 - count; yield return(new WaitForFixedUpdate()); } if (!active) { commentary.PlayCommentary(comment, commentID); HoldButton.UnlockAll(); Destroy(gameObject); yield break; } //Eingangstext ist Voreinstellung: //text.text = "Möchtest du das Tutorial\nzu dem Eisstand sehen?"; textField.gameObject.SetActive(true); buttons.gameObject.SetActive(true); textFieldGroup.alpha = 0; buttons.alpha = 0; for (float count = 0; count < 1; count += timeStep) { buttons.alpha = count; textFieldGroup.alpha = count; yield return(new WaitForFixedUpdate()); } textFieldGroup.alpha = 1; yield break; }
private void Awake() { _holdButton = this; btnReference = GetComponent <Button>(); }
void Start() { this.pad = FindObjectOfType <FixedJoystick>(); this.primaryButton = FindObjectOfType <ActionButton>(); this.secondaryButton = FindObjectOfType <HoldButton>(); }
private void Start() { Instance = this; }