Exemple #1
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());
        }
    }
Exemple #2
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());
        }
    }
Exemple #3
0
 void Update()
 {
     if (Vector2.Distance(Player.transform.position, transform.position) < 0.7f)
     {
         IsPlayerExited = false;
         Character1.IndicatorOn();
         if (moveScript.activate)
         {
             GameObject.Find("AudioSystem").GetComponent <AudioSystem>().CallSound(1, 0.8f);
             moveScript.activate = false;
             if (On == false)
             {
                 Anim.SetBool("On", true);
                 On = true;
             }
             else
             {
                 Anim.SetBool("On", false);
                 On = false;
             }
         }
     }
     else if (!IsPlayerExited)
     {
         IsPlayerExited = true;
         Character1.IndicatorOff();
     }
 }
Exemple #4
0
 void OnTriggerEnter2D(Collider2D Col)
 {
     if (Col.CompareTag("Lifepoint") && Anim.GetBool("Attack"))
     {
         Character1.MinusHp();
     }
 }
Exemple #5
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.CompareTag("Player"))
     {
         Character1.IndicatorOff();
     }
 }
    void Update() //Обновление скрипта
    {
        if ((Vector2.Distance(heartPos.position, playerPos.position) < 1f))
        {
            IsPlayerExited = false;
            Character1.IndicatorOn();
            if (Input.GetKeyDown(KeyCode.E) || moveScript.activate)
            {
                {
                    Heart.SetBool("Heart", false);
                    Character1.HP = 100;
                    GameObject.Find("AudioSystem").GetComponent <AudioSystem>().CallSound(1, 0.8f);
                    Character1.IndicatorOff();
                    Destroy(this);
                }
            }
        }
        else if (!IsPlayerExited)
        {
            IsPlayerExited = true;
            Character1.IndicatorOff();
        }

        //если дистанция между игроком и сердцем меньше 0.6 юнита И кнопка "Е" нажат, то
    }
Exemple #7
0
 private void OnTriggerExit2D(Collider2D col)
 {
     if ((type == 2 || type == 5 || type == 6) && col.CompareTag(tagg))
     {
         Character1.IndicatorOff();
     }
 }
Exemple #8
0
 void OnTriggerExit2D(Collider2D col)
 {
     if (col.CompareTag("Player"))
     {
         CanDo = false;
         Character1.IndicatorOff();
     }
 }
Exemple #9
0
 void OnTriggerStay2D(Collider2D col)
 {
     if (col.CompareTag("Player"))
     {
         CanDo = true;
         Character1.IndicatorOn();
     }
 }
Exemple #10
0
 public void character_construct_set(int num1)
 {
     if (character_null_check(num1) == 1)
     {
         character1[num1] = new Character1(s1, num1);
         character1[num1].init1();
     }
 }
Exemple #11
0
 void OnTriggerEnter2D(Collider2D Col)
 {
     if (Col.CompareTag("Player"))
     {
         HeroIsHere = true;
         Character1.Alert();
     }
 }
Exemple #12
0
 void OnTriggerEnter2D(Collider2D Collider)
 {
     if (Collider.CompareTag("Lifepoint"))
     {
         Character1.MinusHp(Dmg);
         Player.GetComponent <Character1>().DragStart(transform.position);
     }
 }
Exemple #13
0
 void OnTriggerExit2D(Collider2D col)
 {
     if (col.CompareTag("Lifepoint"))
     {
         Character1.MinusHp(damage);
         StartCoroutine(player.GetComponent <Character1>().Drag(transform.position));
     }
 }
Exemple #14
0
 private void Update()
 {
     if (HeroIsHere && Damage)
     {
         StartCoroutine(GameObject.FindGameObjectWithTag("Player").GetComponent <Character1>().Drag(transform.position));
         Character1.MinusHp(15);
     }
 }
Exemple #15
0
 void OnTriggerExit2D(Collider2D col)
 {
     if (col.CompareTag("Lifepoint") && Anim.GetBool("Attack"))
     {
         Character1.MinusHp(20);
         StartCoroutine(Player.GetComponent <Character1>().Drag(transform.position));
     }
 }
Exemple #16
0
 void OnTriggerStay2D(Collider2D Col)
 {
     if (Col.CompareTag("Player") && Damage)
     {
         Character1.Alert();
         Character1.MinusHp();
     }
 }
Exemple #17
0
 void OnTriggerExit2D(Collider2D Col)
 {
     if (Col.CompareTag("Player") && HeroIsHere)
     {
         HeroIsHere = false;
         print("dasas");
         Character1.NoAlert();
     }
 }
Exemple #18
0
    IEnumerator Die()
    {
        GetComponent <Animator>().SetBool("Break", true);
        Rigi.simulated = false;
        yield return(new WaitForSeconds(2f));

        Character1.NoAlert();
        Destroy(gameObject);
    }
Exemple #19
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.transform.tag == "Player")
     {
         Character1 character1 = collision.GetComponent <Character1>();
         character1.SpawnX = point.transform.position.x;
         character1.SpawnY = point.transform.position.y;
     }
 }
Exemple #20
0
 // Start is called before the first frame update
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         StartCoroutine(GameObject.FindGameObjectWithTag("Player").GetComponent <Character1>().DragBack());
         Character1.Alert();
         Character1.MinusHp(15);
     }
 }
Exemple #21
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.CompareTag("Player") && !ignore)
     {
         StartCoroutine(Player.GetComponent <Character1>().Drag(transform.position));
         Character1.MinusHp(25);
         ignore = false;
     }
 }
Exemple #22
0
    private void Awake()
    {
        if (playerCharacter == null)
        {
            playerCharacter = GameObject.FindGameObjectWithTag("Player").GetComponent <Character1>();
        }

        e_basic = GetComponent <Rigidbody>();
    }
Exemple #23
0
    void Fire()
    {
        playSingleleSound(shootSnd);
        MuzzleFlash.Play();
        clipAmmo--;
        RaycastHit hit;

        if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range))
        {
            Debug.Log(hit.transform.name);

            Enemy enemy = hit.transform.GetComponent <Enemy>();

            GoblinEnemy GoblinEnemy = hit.transform.GetComponent <GoblinEnemy>();

            BompEnemy BompEnemy = hit.transform.GetComponent <BompEnemy>();

            BossEnemy BossEnemy = hit.transform.GetComponent <BossEnemy>();

            if (GameManager.player == true)
            {
                Character1 Player2 = hit.transform.GetComponent <Character1>();
                if (Player2 != null)
                {
                    Player2.TakeDamage(Damage);
                }
            }


            if (BossEnemy != null)
            {
                BossEnemy.TakeDamage(Damage);
            }

            if (BompEnemy != null)
            {
                BompEnemy.TakeDamage(Damage);
            }

            if (GoblinEnemy != null)
            {
                GoblinEnemy.TakeDamage(Damage);
            }

            if (enemy != null)
            {
                enemy.TakeDamage(Damage);
            }

            GameObject ImplactGameObejct = Instantiate(ImplactEfect, hit.point, Quaternion.LookRotation(hit.normal));
            Destroy(ImplactGameObejct, 0.5f);
        }
        anim.SetTrigger("Shoot");
    }
Exemple #24
0
 private void OnTriggerEnter2D(Collider2D Col)
 {
     if (Col.CompareTag("Player") && Attack == true)
     {
         Character1.Alert();
         Anim.SetInteger("Stage", 1);
         StartCoroutine(WaitAttack());
         StartCoroutine(EnableLife());
         Attack = false;
     }
 }
Exemple #25
0
 private void OnTriggerExit2D(Collider2D Col)
 {
     if (Col.CompareTag("Player"))
     {
         Character1.NoAlert();
         Attack = true;
         Anim.SetInteger("Stage", 2);
         MonsterLife.SetActive(false);
         StopAllCoroutines();
     }
 }
Exemple #26
0
 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.transform.tag == "Player")
     {
         Character1 character1 = collision.GetComponent <Character1>();
         character1.Damage(damage);
     }
     if (collision.transform.tag == "hitbox")
     {
         smoke clone = (smoke)Instantiate(dust, gameObject.transform.position, gameObject.transform.rotation);
         Destroy(gameObject);
     }
 }
Exemple #27
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);
    }
Exemple #28
0
        public void Start()
        {
            int v = 0;

            Character1 = InitPlayer(0, true);
            Character2 = InitPlayer(1, false);
            World      = InitWorld();
            while (Character1.Alive && !World.HasWinner())
            {
                try
                {
                    Turn++;
                    World.Show(Character1, Character2, Turn, true);
                    Character1.Moving();
                    Console.WriteLine("Tap <Enter> to finish move...");
                    Console.ReadLine();
                    World.Show(Character1, Character2, Turn, false);
                    Character2.Moving();
                    Console.WriteLine("Tap <Enter> to finish move...");
                    Console.ReadLine();
                    World.Show(Character1, Character2, Turn);
                    foreach (Bot item in GameObjects.Where(x => x is Bot b && b.Alive))
                    {
                        item.Move("");
                    }
                    Console.ReadKey();
                    if (Turn == 2)
                    {
                        var a = 5 / v;
                        throw new GameException("Buy this game to continue");
                    }
                }
                catch (GameException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                catch (DivideByZeroException ex)
                {
                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    Console.ReadLine();
                    Console.WriteLine("End turn.");
                }
            }

            World.Show(Character1, Character2, Turn);
            Console.WriteLine($"Congrats {World.GetWinner().Name}!");
        }
    // 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;
            }
        }
    }
Exemple #30
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        Character1 character1 = Player.GetComponent <Character1>();
        breakable  broke      = collision.gameObject.GetComponent <breakable>();

        if (collision.transform.tag != "breakable")
        {
            character1.DownDash();

            gameObject.SetActive(false);
        }
        if (broke != null)
        {
            broke.Break();
        }
    }