private void OnCollisionEnter2D(Collision2D collision) { GameObject obj = collision.gameObject; if (PlayerZone.IsOutside && !MessageSystemPlayingScene.Player.CompareTag("InVisible") && !MessageSystemPlayingScene.IsDead) { PlayerZone.MoveToPlayerZone(); } if ((obj.CompareTag("Player") || (obj.CompareTag("Hit") && obj.name == "Brian")) && MessageSystemPlayingScene.IsJump) { MessageSystemPlayingScene.exitFromPingPong = false; if (!PlayerZone.IsOutside) { MessageSystemPlayingScene.SetDefaultConstraints(); } else { MessageSystemGameBlock.SetPlayingConstraints(); } if (Conecting.Management == 0 && !TapToGo.Screen.activeInHierarchy) { TapToGo.Screen.SetActive(true); } MessageSystemPlayingScene.IsJump = false; MessageSystemPlayingScene.Player.GetComponent <Animator>().SetBool("IsRunAgain", true); StartCoroutine(PreparationToJump()); } }
private void OnCollisionEnter2D(Collision2D collision) { if (PlayerZone.IsOutside) { PlayerZone.MoveToPlayerZone(); } if (collision.gameObject.CompareTag("Player") && MessageSystemPlayingScene.IsJump && !Cube.IsCollision) { MessageSystemPlayingScene.exitFromPingPong = false; if (!PlayerZone.IsOutside) { MessageSystemPlayingScene.SetDefaultConstraints(); } else { MessageSystemGameBlock.SetPlayingConstraints(); } MessageSystemPlayingScene.IsJump = false; MessageSystemPlayingScene.Player.GetComponent <Animator>().SetBool("IsRunAgain", true); StartCoroutine(PreparationToJump()); } }
public static void SelectHero(GameObject hero) { foreach (GameObject obj in circle) { if (obj.name == hero.name) { obj.GetComponent <Animation>().Play("RizeCircle"); } else if (playerName == obj.name) { obj.GetComponent <Animation>().Play("ReduceCircle"); if (IsActiveColider(playerName)) { obj.GetComponentInChildren <BoxCollider2D>().enabled = true; } else { ChangeToCrossSprite(obj); } } else { if (IsActiveColider(obj.name)) { obj.GetComponentInChildren <BoxCollider2D>().enabled = true; } } } playerName = hero.name; player.SetActive(false); Vector2 positionLastPlayer = player.transform.position; string nameLastPlayer = player.name; if (!isStart) { storageVoid[0, (int)hash[playerName]](); } else { ChangeHeroAfterStart(); } if (IsStart && IsActiveColider(nameLastPlayer)) { player.transform.position = positionLastPlayer; } if (player.transform.position.x >= 0) { PlayerZone.IsOutside = false; PlayerZone.SetNoneRigid(); } if (PlayerZone.IsOutside && !isDead) { PlayerZone.MoveToPlayerZone(); } if (isJump && !isDead) { MessageSystemGameBlock.SetPlayingConstraints(); } if (!animationDeathIsFinished) { MessageSystemGameBlock.StartGame(); isDead = false; EnableCollider(); } DeadLine.IsDeadLine = false; player.SetActive(true); }