Exemplo n.º 1
0
    void Update()
    {
        if (Vector2.Distance(Player.transform.position, transform.position) < 3f && Active && !Died)
        {
            Character1.Alert();
            Active = false;
            StartCoroutine(Attack());
        }

        if (Vector2.Distance(Player.transform.position, transform.position) > 5f && !Active)
        {
            Active = true;
            MonsterLife.SetActive(false);
            Anim.SetBool("Attack", false);
            Character1.NoAlert();
            if (!Died)
            {
                StopAllCoroutines();
            }
            Rigi.velocity = Vector2.zero;
        }
        if (MonsterLife.GetComponent <MonsterLife>().Damaged)
        {
            MonsterLife.GetComponent <MonsterLife>().Damaged = false;
            MonsterLife.SetActive(false);
            StopAllCoroutines();
            Died = true;
            StartCoroutine(Die());
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        if (Vector2.Distance(player.transform.position, transform.position) < alert_distance && active && !died)
        {
            Character1.Alert();
            active = false;
            StartCoroutine(Attack1());
        }

        if (Vector2.Distance(player.transform.position, transform.position) > alert_distance + 2 && !active)
        {
            active = true;
            monster_life.SetActive(false);
            anim.SetBool("Attack", false);
            Character1.NoAlert();
            if (!died)
            {
                StopAllCoroutines();
            }
            rigi.velocity = Vector2.zero;
        }
        if (monster_life.GetComponent <MonsterLife>().Damaged)
        {
            monster_life.GetComponent <MonsterLife>().Damaged = false;
            monster_life.SetActive(false);
            StopAllCoroutines();
            died = true;
            StartCoroutine(Die());
        }
    }
Exemplo n.º 3
0
    IEnumerator Die()
    {
        GetComponent <Animator>().SetBool("Break", true);
        Rigi.simulated = false;
        yield return(new WaitForSeconds(2f));

        Character1.NoAlert();
        Destroy(gameObject);
    }
Exemplo n.º 4
0
 void OnTriggerExit2D(Collider2D Col)
 {
     if (Col.CompareTag("Player") && HeroIsHere)
     {
         HeroIsHere = false;
         print("dasas");
         Character1.NoAlert();
     }
 }
Exemplo n.º 5
0
 private void OnTriggerExit2D(Collider2D Col)
 {
     if (Col.CompareTag("Player"))
     {
         Character1.NoAlert();
         Attack = true;
         Anim.SetInteger("Stage", 2);
         MonsterLife.SetActive(false);
         StopAllCoroutines();
     }
 }
Exemplo n.º 6
0
    IEnumerator Die()
    {
        rigi.drag     = 20;
        col.isTrigger = false;
        rigi.drag     = 0;
        rigi.AddForce(-(player.transform.position - transform.position).normalized * die_force, ForceMode2D.Force);
        GetComponent <Animator>().SetBool("Break", true);
        yield return(new WaitForSeconds(1f));

        rigi.drag      = 20;
        rigi.simulated = false;
        Character1.NoAlert();
        Destroy(this);
    }
Exemplo n.º 7
0
    // Start is called before the first frame update
    void OnTriggerEnter2D(Collider2D Collider)
    {
        if (Collider.CompareTag("Player"))
        {
            switch (on)
            {
            case true:
                Character1.Alert();
                break;

            case false:
                Character1.NoAlert();
                break;
            }
        }
    }
Exemplo n.º 8
0
    IEnumerator Die()
    {
        Rigi.drag     = V;
        Col.isTrigger = false;
        Rigi.drag     = 0;
        Rigi.AddForce(-(Player.transform.position - transform.position).normalized * Force, ForceMode2D.Force);
        Anim.SetInteger("Stage", 99);
        yield return(new WaitForSeconds(1f));

        Rigi.drag      = V;
        Rigi.simulated = false;
        yield return(new WaitForSeconds(3f));

        Character1.NoAlert();
        Destroy(this);
        yield return(new WaitForSeconds(3f));
    }
Exemplo n.º 9
0
    IEnumerator SpareMe2()//отступает
    {
        StartCoroutine(TileAppear());
        TC5.gameObject.SetActive(false);
        slider.SetActive(false);
        Heart.SetActive(false);
        Anim.SetBool("Attack", true);
        CanDoDamage   = true;
        Col.isTrigger = true;
        Rigi.drag     = 0;
        Anim.speed    = 1;
        Rigi.AddForce((new Vector2(-16f, 1f) - (Vector2)transform.position) * Force, ForceMode2D.Impulse);
        Anim.SetInteger("Stage", 4);
        yield return(new WaitForSeconds(0.5f));

        if (BossModeflag)
        {
            StartCoroutine(BossModeEnd());
        }
        Anim.SetInteger("Stage", 1);
        Rigi.drag   = V;
        CanDoDamage = false;
        Anim.SetBool("Attack", false);
        Col.isTrigger = false;
        Phrases[2].SetActive(true);
        yield return(new WaitForSeconds(1f));

        Distance = Vector2.Distance(Player.transform.position, transform.position);
        Anim.SetInteger("Stage", 99);
        Rigi.drag = 100;
        LastStady = true;
        if (BossModeflag)
        {
            yield break;
        }
        Heart.SetActive(true);
        slider.gameObject.SetActive(true);
        StartCoroutine(Heart.GetComponent <MonsterLife>().DeathWait());
        try { GameObject.Find("DeleteObjects").SetActive(false); } catch { }
        Character1.NoAlert();
        GameObject.Find("AudioSystem").GetComponent <AudioSystem>().CallMusic(0);
    }
Exemplo n.º 10
0
    IEnumerator Attack()
    {
        Character1.Alert();
        Anim.speed = 0;
        yield return(new WaitForSeconds(0.5f));

        Col.isTrigger = true;
        Anim.speed    = 1;
        Rigi.AddForce((Player.transform.position - transform.position) * Force, ForceMode2D.Impulse);
        yield return(new WaitForSeconds(1f));

        Rigi.drag = 20;
        Anim.SetBool("Attack", false);
        yield return(new WaitForSeconds(3f));

        Col.isTrigger = false;
        Rigi.drag     = 0;
        Active        = true;
        Character1.NoAlert();
    }
Exemplo n.º 11
0
 // Update is called once per frame
 void Update()
 {
     Rigi.velocity = Vec * Force;
     if (Vector2.Distance(Player.transform.position, gameObject.transform.position) < 3 && IsAttacked == false && Alive)
     {
         StopAllCoroutines();
         StartCoroutine(Attack());
         Character1.Alert();
         IsAttacked = true;
         alert      = true;
     }
     if (Vector2.Distance(Player.transform.position, gameObject.transform.position) > 3 && Alive)
     {
         MonsterLife.SetActive(false);
         IsAttacked = false;
         if (alert)
         {
             StopAllCoroutines();
             Character1.NoAlert();
             StartCoroutine(Going());
             alert = false;
             Vec   = Vector2.zero;
         }
     }
     if (MonsterLife.GetComponent <MonsterLife>().Damaged)
     {
         MonsterLife.GetComponent <MonsterLife>().Damaged = false;
         HP--;
         if (HP < 1)
         {
             StopAllCoroutines();
             IsAttacked = true;
             Alive      = false;
             StartCoroutine(Die());
             Character1.NoAlert();
             gameObject.GetComponent <State>().dead = true;
             return;
         }
         StartCoroutine(Drag());
     }
 }
Exemplo n.º 12
0
 // Update is called once per frame
 void Update()
 {
     if (Vector2.Distance(Player.transform.position, gameObject.transform.position) < 5 && IsAttacked == false && Alive)
     {
         Character1.Alert();
         StartCoroutine(Jump());
         IsAttacked = true;
         alert      = true;
     }
     if (Vector2.Distance(Player.transform.position, gameObject.transform.position) > 5 && Alive)
     {
         MonsterLife.SetActive(false);
         Anim.SetInteger("Vector", 1);
         StopAllCoroutines();
         IsAttacked = false;
         if (alert)
         {
             Character1.NoAlert();
             alert = false;
         }
     }
     if (MonsterLife.GetComponent <MonsterLife>().Damaged)
     {
         MonsterLife.GetComponent <MonsterLife>().Damaged = false;
         HP--;
         if (HP < 1)
         {
             StopAllCoroutines();
             IsAttacked = true;
             Alive      = false;
             StartCoroutine(Die());
             Character1.NoAlert();
             return;
         }
         StartCoroutine(Drag());
     }
 }
Exemplo n.º 13
0
    void ChooseAttack4()
    {
        int[] MassPos;
        if (StageCount == 0)
        {
            Phrases[3].SetActive(false);
            Phrases[3].SetActive(true);
            Anim.SetInteger("Stage", 3);
            StartCoroutine(StarAttack(posX[2], posY[2], 1f, 7));
        }
        else if (StageCount == 1)
        {
            Phrases[5].SetActive(true);
            Anim.SetInteger("Stage", 0);
            MassPos = new int[] { 0, 1, 0, 1, 0, 1, 0, 1 };
            StartCoroutine(CrossSpawn(Bullets[9], MassPos, 2, 10.8f));
        }
        else if (StageCount == 2)
        {
            MassPos = new int[] { 0, 1, 1, 1, 0, 1, 1, 1 };
            StartCoroutine(CrossSpawn(Bullets[0], MassPos, 2f, 0.1f));
        }
        else if (StageCount == 3)
        {
            MassPos = new int[] { 1, 1, 0, 1, 1, 1, 0, 1 };
            StartCoroutine(CrossSpawn(Bullets[0], MassPos, 2f, 0.1f));
        }
        else if (StageCount == 4)
        {
            StartCoroutine(LineObjectSpawn(Bullets[2], 0.2f, 0.1f, -2f, 1f));
        }
        else if (StageCount == 5)
        {
            StartCoroutine(LineObjectSpawn(Bullets[11], 0f, 0f, -2f));
        }
        else
        {
            if (Lifes == 0)
            {
                CanDoDamage = false;
                Phrases[6].SetActive(true);
                //GameObject.Find("AudioSystem").GetComponent<AudioSystem>().CallMusic(4, 3f);
                Anim.SetInteger("Stage", 5);
                StartCoroutine(Bushed());
                TC1.gameObject.SetActive(false);
                TC2.gameObject.SetActive(false);
                TC3.gameObject.SetActive(false);
                TC4.gameObject.SetActive(false);
                if (!BossModeflag)
                {
                    Anim.SetInteger("Stage", 6);
                }
                {
                    StartCoroutine(StartCutScn());
                    Heart.gameObject.SetActive(false);
                    slider.gameObject.SetActive(false);
                }
                return;
            }
            Character1.NoAlert();
            Heart.gameObject.SetActive(true);
            slider.gameObject.SetActive(false);

            if (Lifes < 1 && BossModeflag)
            {
                StartCoroutine(BossModeEnd());
                Heart.gameObject.SetActive(false);
                return;
            }
        }

        StageCount++;
    }