isAlive() public method

public isAlive ( ) : bool
return bool
    void faceMouse()
    {
        mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        if (hero.isAlive())
        {
            direction = new Vector2(
                mousePosition.x - _myTransform.position.x,
                mousePosition.y - _myTransform.position.y);

            transform.up = direction;
        }
    }
Esempio n. 2
0
    // Update is called once per frame
    public override void InGameUpdate()
    {
        if (isAlive())
        {
            if (spawningComplete)
            {
                if (automaticZSort && !Game.game.renderQueue.Contains(this))
                {
                    Game.game.renderQueue.Add(this);
                }

                if (Game.game.currentDialog == null)
                {
                    Hero hero = (Hero)GameObject.Find("Hero").GetComponent <Hero>();
                    if (hero && hero.isAlive())
                    {
                        if (currentTarget == null)
                        {
                            currentTarget = hero;
                        }
                    }
                    else
                    {
                        currentTarget = null;
                        changeAnimation("idle");
                    }

                    if (currentTarget != null)
                    {
                        if (currentAttack == null)
                        {
                            currentAttack = pickAttackForTarget(currentTarget);
                        }

                        if (currentAttack != null)
                        {
                            currentAttack.attackUpdate();
                        }
                    }
                }
            }
        }
        else if (!isDying && !isDead)
        {
            tk2dAnimatedSprite sprite = GetComponent <tk2dAnimatedSprite>();
            sprite.localTimeScale = 1.0f;
            changeAnimation("death", onDie);
            isDying = true;
            GameObject sounds = GameObject.Find("Sound");
            GameObject.Destroy(sounds);
            GameObject.Destroy(stateSound);
            Game.game.playSoundFromList(onDieSounds);
        }
    }
Esempio n. 3
0
    IEnumerator Attack1()
    {
        GameObject    scene  = GameObject.FindWithTag("ActionCam");
        BattleManager battle = GameObject.FindWithTag("BattleManager").GetComponent <BattleManager>();
        HeroDisplay   pos1   = GameObject.FindWithTag("Hero1").GetComponent <HeroDisplay>();
        HeroDisplay   pos2   = GameObject.FindWithTag("Hero2").GetComponent <HeroDisplay>();
        HeroDisplay   pos3   = GameObject.FindWithTag("Hero3").GetComponent <HeroDisplay>();
        Hero          hero1  = pos1.getHero();
        Hero          hero2  = pos2.getHero();
        Hero          hero3  = pos3.getHero();

        List <Hero>    heroes  = new List <Hero>();
        List <Vector3> heroPos = new List <Vector3>();
        List <string>  damages = new List <string>();

        if (hero1.isAlive())
        {
            heroes.Add(hero1);
            heroPos.Add(new Vector3(900, 100, 0));
        }
        if (hero2.isAlive())
        {
            heroes.Add(hero2);
            heroPos.Add(new Vector3(700, 100, 0));
        }
        if (hero3.isAlive())
        {
            heroes.Add(hero3);
            heroPos.Add(new Vector3(500, 100, 0));
        }


        battle.DisplayAbilityName("Daunting \n Flames");
        pos1.SelectTarget();
        pos2.SelectTarget();
        pos3.SelectTarget();


        yield return(new WaitForSeconds(1));

        damages.Add(hero1.decreaseHealth(getAttackDamage() / 2, getBaseCrit()));
        damages.Add(hero2.decreaseHealth(getAttackDamage() / 2, getBaseCrit()));
        damages.Add(hero3.decreaseHealth(getAttackDamage() / 2, getBaseCrit()));


        scene.GetComponent <DisplayScene>().BattleDispayEnemyAttack(heroes, this.GetComponent <Enemy>(), heroPos, new Vector3(0, 100, 0), damages);



        battle.ViewBattle(0);
    }
Esempio n. 4
0
    void Update()
    {
        if (hero.isAlive() == false || hero.drugWithdrawal <= 0 || hero.poisoning > 40)
        {
            anim.enabled         = false;
            spriteR.sprite       = Resources.Load <Sprite>(deadHero);
            transform.localScale = new Vector3(0.22f, 0.22f, 0.22f);
            if (GameObject.Find("Inventory").GetComponent <Inventory>().GetUsingWeapon() != null)
            {
                GameObject.Find("Inventory").GetComponent <Inventory>().GetUsingWeapon().CanUse = false;
            }

            Pause();
        }
    }
Esempio n. 5
0
 // Update is called once per frame
 void Update()
 {
     if (!hero.isAlive())
     {
         text.text = "YOU ARE DEAD";
     }
     if (hero.drugWithdrawal <= 0)
     {
         text.text = "YOU ARE DEAD CUZ OF DRUG WITHDRWAL";
     }
     if (hero.poisoning >= 40)
     {
         text.text = "YOU ARE DEAD CUZ OF POSIONING";
     }
 }