private IEnumerator Start() { yield return(null); while (HeroController.instance == null) { yield return(null); } float heroX = HeroController.instance.transform.position.x; float bombX = transform.position.x; float velX = (heroX - bombX) / Lifetime; _cc.radius = 0.2f; _cc.isTrigger = true; _rb.isKinematic = true; _rb.velocity = new Vector2(velX, ThrowHeight); _sr.sprite = TisoAnimator.FindSprite(TisoAnimator.TisoSpritesCustom, "Bomb"); gameObject.AddComponent <DebugColliders>(); gameObject.AddComponent <NonBouncer>(); yield return(new WaitForSeconds(Lifetime)); Explode(); }
private void AddCustomComponents() { _anim = gameObject.AddComponent <TisoAnimator>(); _audio = gameObject.AddComponent <TisoAudio>(); _phaseCtrl = gameObject.AddComponent <PhaseControl>(); _attacks = gameObject.AddComponent <TisoMoves>(); _sr = GetComponent <SpriteRenderer>(); }
private void DeathHandler() { Vector2 position = transform.position + Vector3.down * 1.0f; Quaternion rotation = Quaternion.identity; GameObject deadTiso = Instantiate(new GameObject("Tiso Corpse"), position, rotation); Sprite deadTisoSprite = TisoAnimator.FindSprite(TisoAnimator.TisoSpritesGodhome, "Dead"); deadTiso.AddComponent <SpriteRenderer>().sprite = deadTisoSprite; deadTiso.AddComponent <TisoDeath>(); }
private void Awake() { _instance = this; _anim = GetComponent <TisoAnimator>(); _audio = GetComponent <TisoAudio>(); _rand = new Random(); _rb = GetComponent <Rigidbody2D>(); _recoil = GetComponent <Recoil>(); _sr = GetComponent <SpriteRenderer>(); _phaseCtrl = GetComponent <PhaseControl>(); _phaseCtrl.TriggeredPhase2 += OnTriggeredPhase2; _phaseCtrl.TriggeredPhase3 += OnTriggeredPhase3; HeroController.instance.OnDeath += OnHeroDeath; _bee = TisoSpencer.PreloadedGameObjects["Bee"]; _hornet = TisoSpencer.PreloadedGameObjects["Hornet"]; _kin = TisoSpencer.PreloadedGameObjects["Kin"]; _mageLord = TisoSpencer.PreloadedGameObjects["Mage"].LocateMyFSM("Mage Lord"); }
private void Awake() { GameObject go = gameObject; go.SetActive(true); go.layer = 12; go.AddComponent <DebugColliders>(); go.AddComponent <DamageHero>().damageDealt = 1; go.AddComponent <TinkEffect>(); go.AddComponent <TinkSound>(); _audio = go.AddComponent <AudioSource>(); _rb = go.AddComponent <Rigidbody2D>(); _rb.isKinematic = true; _collider = go.AddComponent <BoxCollider2D>(); _collider.enabled = true; _collider.size = new Vector2(2.0f, 0.75f); _sr = go.AddComponent <SpriteRenderer>(); _tiso = GameObject.Find("Tiso Boss"); _tisoPos = _tiso.transform.position; _sr.sprite = TisoAnimator.FindSprite(TisoAnimator.TisoSpritesGodhome, "Shield"); }