Exemplo n.º 1
0
Arquivo: Bomb.cs Projeto: jngo102/Tiso
        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();
        }
Exemplo n.º 2
0
        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>();
        }
Exemplo n.º 3
0
        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");
        }