// Use this for initialization void Start() { cc = GetComponent <CharacterController2D>(); audioManager = FindObjectOfType <AudioManager>(); sf = GetComponent <ScreenFreeze>(); gfm = FindObjectOfType <GameFeelManager>(); }
static public void Freeze(int frames) { if (frames == 0) { return; } if (false == _instance) { GameSpeed = Time.timeScale; var o = new GameObject("Screen Freeze"); _instance = o.AddComponent <ScreenFreeze>(); } var converted = frames / 60f; _instance.duration = Mathf.Max(converted, _instance.duration); }
private void OnTriggerEnter2D(Collider2D collision) { if (dead) { return; } var fat = collision.GetComponent <FatScript>(); if (fat.Fat == 4) { Kill(); return; } var deltay = collision.transform.position.y - transform.position.y; var player = collision.GetComponent <PlatformingCharacter>(); bool onTop = deltay > .1f && player.VMomentum < 0f; if (onTop) { ScreenFreeze.Freeze(6); if (fat.Fat < 3) { player.VMomentum = player.jumpForce; } if (fat.Fat == 3) { player.VMomentum = player.jumpForce * .5f; } if (fat.Fat > 1) { Kill(); } else { Flinch(); } } else { MySceneManager.Kill(); // Debug.Log("Kill!"); } }
private void OnTriggerEnter2D(Collider2D collision) { // FindObjectOfType<Win>().NeedCoin--; AudioPool.PlaySound(transform.position, GetSound); var fatty = collision.transform.GetComponent <FatScript>(); if (dietFood) { fatty.DecreaseFat(); } else { fatty.IncreaseFat(); } var platty = collision.transform.GetComponent <Mobile>(); platty.HMomentum *= .75f; if (platty.VMomentum > 0f) { platty.VMomentum *= .5f; } ScreenFreeze.Freeze(5); Destroy(gameObject); }