// Use this for initialization // int movementDirection; void Start() { oldColliderPoints = new Vector2[4]; newColliderPoints = new Vector2[4]; oldColliderPoints[0] = new Vector2(0.47f, -0.4f); oldColliderPoints[1] = new Vector2(0.47f, 0.65f); oldColliderPoints[2] = new Vector2(-0.47f, 0.65f); oldColliderPoints[3] = new Vector2(-0.47f, -0.4f); newColliderPoints[0] = new Vector2(0.47f, -0.2f); newColliderPoints[1] = new Vector2(0.47f, 0.4f); newColliderPoints[2] = new Vector2(-0.47f, 0.4f); newColliderPoints[3] = new Vector2(-0.47f, -0.2f); EnemyRigidbody = GetComponent <Rigidbody2D>(); SetParaTroopaTimer(); movementDirection = -1; shellSlideCount = 0; scoore = transform.GetChild(1); scoore2 = transform.GetChild(2); audioSource = GetComponent <AudioSource>(); backToLifeLenght = BackToLifeLenght; groundCheck = transform.Find("Ground check"); edgeCollider = GetComponent <EdgeCollider2D>(); boxCollider = GetComponent <BoxCollider2D>(); animator = GetComponent <Animator>(); shellSlide = false; backToLifeTimer = BackToLifeTime; if (ParaTroopa && !RedKoopaTroopa) { childCollider = groundCheck.GetComponent <EdgeCollider2D>(); SetParaTroopaTimer(); } scooreScript = transform.GetChild(1).GetComponent <Scoore_script>(); scooreScript.parent = transform; scooreScript2 = transform.GetChild(2).GetComponent <Scoore_script>(); scooreScript2.parent = transform; spriteRenderer = GetComponent <SpriteRenderer>(); Vector2[] temp = spriteRenderer.sprite.vertices; string scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; if (scene.Contains("OVERWORLD")) { animator.SetBool("OverWorld", true); } else if (scene.Contains("Castle")) { animator.SetBool("Castle", true); } EnemyRigidbody.constraints = RigidbodyConstraints2D.FreezeRotation; }
// Use this for initialization void Start() { CoinRigibody = GetComponent <Rigidbody2D>(); scoore = transform.GetChild(0); script = GetComponentInChildren <Scoore_script>(); audioSource = GetComponent <AudioSource>(); spriteRenderer = GetComponent <SpriteRenderer>(); CoinRigibody.isKinematic = false; CoinRigibody.AddRelativeForce(new Vector2(0, 9), ForceMode2D.Impulse); // Pushes coin up QuestionBlockCenter = transform.position.y - 0.5f; }
public void TimeCounting() { if (GameStart && !stop) { if (!Flag_Script.FlagTouched) // Time freezes once Mario touches the flag, ... { if (!SceneLoader_script.loading && !Mario_script.GameOver) //... dies or new sceene is loading. { if (Bowser_script.BowserFellDown) { stop = true; } if (second > 0) { second -= Time.deltaTime; } else { if (!setBlackScreen && GameTimer > 0) { GameTimer--; TimerText.text = GameTimer.ToString(); if (!Mario_script.MarioInCastle) { second = secondValue; } else { second = quickSecondValue; // Time passes really quick at once Mario reached the castle Scoore_script.AddTotalScoore(10); } } } } } } }
public static bool FlagTouched; // Indicates that Mario touced the flag's pole // Use this for initialization void Start() { scooreScript = GetComponentInChildren <Scoore_script>(); Flag = transform.Find("Flag child"); FlagRigidbody = Flag.GetComponent <Rigidbody2D>(); }