Пример #1
0
        protected IEnumerator Smash()
        {
            isBasicSmashing = true;
            float _time = Time.time;

            while (true)
            {
                if (Time.time - _time >= androidInfo_Basic.basicSmashStartTime)
                {
                    break;
                }
                yield return(null);
            }
            //Animator Smash trigger
            m_Animator.SetBool("Walk", false);
            m_Animator.SetBool("Alert", false);
            if (distance <= androidInfo_Basic.basicSmashRadius && (playerObject.transform.position.x - transform.position.x >= 0 ? 0 : 180f) == Mathf.Round(transform.rotation.eulerAngles.y))
            {
                StatusManagement _status = playerObject.GetComponent <StatusManagement>();
                if (_status != null)
                {
                    _status.GetDamage(androidInfo_Basic.damage_basicSmash, gameObject);
                }
            }
            isBasicSmashing      = false;
            isCheckingBasicSmash = false;
        }
Пример #2
0
 void Bomb(Collider2D other = null)
 {
     if (bombed)
     {
         return;
     }
     SendMessage("RandomPlay", "Bomb");
     bombed = true;
     speed  = 0;
     if (Random.Range(0, 2) == 0)
     {
         m_Animator.SetTrigger("Bomb1");
     }
     else
     {
         m_Animator.SetTrigger("Bomb2");
     }
     Collider2D[] overlaps = Physics2D.OverlapBoxAll(bombPosition.position + new Vector3(0, 1 - 0.6f, 0), new Vector2(3, 2), 0);
     foreach (Collider2D c in overlaps)
     {
         StatusManagement _status = c.gameObject.GetComponent <StatusManagement>();
         if (_status == null)
         {
             continue;
         }
         if (c.tag == "Player" || (other != null && other.tag == "Player"))
         {
             _status.GetDamage(damage, GameObject.Find("FinalBoss"));
             break;
         }
     }
 }
Пример #3
0
        IEnumerator IgnoreDamaging(StatusManagement statusManagement)
        {
            //Debug.Log("damage ignore");
            statusManagement.isDamageable = false;
            yield return(new WaitForSeconds(getDamageDelay));

            statusManagement.isDamageable = true;
            //Debug.Log("damage unignore");
        }
Пример #4
0
        public void SendDamageToHitter(GameObject hitter)
        {
            StatusManagement hitterStatus = hitter.GetComponent <StatusManagement>();

            if (hitterStatus != null)
            {
                hitterStatus.GetDamage(Mathf.RoundToInt(playerStatus.m_baseHealth * returnRatio), playerStatus.gameObject);
            }
        }
Пример #5
0
 void OnCollisionEnter2D(Collision2D other)
 {
     if (other.transform.tag == "Player" && !isDead)
     {
         StatusManagement _status = other.gameObject.GetComponent <StatusManagement>();
         if (_status != null)
         {
             _status.GetMaxDamageNoExceptions(gameObject);
         }
     }
 }
Пример #6
0
 void OnTriggerStay2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         if (isBombing)
         {
             StatusManagement _status = other.gameObject.GetComponent <StatusManagement>();
             if (_status != null)
             {
                 _status.GetDamage(flyInfo.damage_Bomb, gameObject);
             }
         }
         else if (findPlayer)
         {
             Bomb();
         }
     }
 }
Пример #7
0
        void Crash(Transform _hit = null)
        {
            //setAnimation Boom
            HitCheck      hitCheck  = GetComponent <HitCheck>();
            List <string> targetTag = hitCheck.targetTag;

            Collider2D[] overlaps = Physics2D.OverlapCircleAll(transform.position, splashRadius);
            foreach (Collider2D c in overlaps)
            {
                StatusManagement _status = c.gameObject.GetComponent <StatusManagement>();
                if (_status == null)
                {
                    continue;
                }
                if (targetTag.Contains(c.tag) && (_hit == null || _hit.transform != c.transform))
                {
                    _status.GetDamage(hitCheck.damage, hitCheck.shooter);
                }
            }
        }
Пример #8
0
        void FireMessage(CurrentInput _currentInput)
        {
            if (isMeleeAttacking)
            {
                return;
            }

            Collider2D[] overlaps = Physics2D.OverlapCircleAll(transform.position + playerCollider.transform.right * 0.5f, meleeAttackRange);

            foreach (Collider2D _c in overlaps)
            {
                if (_c.tag == "Monster")
                {
                    m_Animator.SetTrigger("MeleeAttack");
                    isMeleeAttacking = true;
                    StartCoroutine("MeleeAttacking");
                    List <GameObject> meleeAttackObjects = new List <GameObject>();
                    foreach (Collider2D __c in overlaps)
                    {
                        if (__c.tag == "Monster" && !meleeAttackObjects.Contains(__c.gameObject))
                        {
                            meleeAttackObjects.Add(__c.gameObject);
                            StatusManagement _status = __c.GetComponent <StatusManagement>();
                            if (_status != null)
                            {
                                _status.GetDamage(meleeAttackDamage, gameObject);
                            }
                        }
                    }
                    break;
                }
            }
            // physics2D 로 주변 콜라이더 다 탐색. 그리고 그 안에 몬스터가있으면 근접공격 하기.
            if (!isMeleeAttacking)
            {
                gameObject.SendMessage("Fire", _currentInput, SendMessageOptions.DontRequireReceiver);
            }
        }
Пример #9
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player" && !used)
     {
         used = true;
         SendMessage("Play", "Glup");
         StatusManagement status     = other.GetComponent <StatusManagement>();
         float            baseHealth = status.m_baseHealth;
         if (status.m_currentHealth + itemInfo.hpHeal > baseHealth)
         {
             status.m_currentHealth = status.m_baseHealth;
         }
         else
         {
             status.m_currentHealth += itemInfo.hpHeal;
         }
         StopCoroutine("Hover");
         GetComponent <SpriteRenderer>().enabled = false;
         itemParticle.SetActive(false);
         Instantiate(pickPopParticle, transform);
         Destroy(gameObject, 0.8f);
     }
 }
Пример #10
0
        IEnumerator Move()
        {
            bool moveHori = Random.Range(0, 2) == 0 ? true : false;

            while (true)
            {
                if (moveHori)
                {
                    int hori = (goHere - transform.position).x > 0 ? 1 : -1;
                    transform.position += new Vector3(hori * speed * Time.deltaTime, 0, 0);
                    if (hori == -1 ? transform.position.x <= goHere.x : transform.position.x >= goHere.x)
                    {
                        Vector3 result = transform.position;
                        result.x           = goHere.x;
                        transform.position = result;
                        moveHori           = false;
                    }
                }
                else
                {
                    int verti = (goHere - transform.position).y > 0 ? 1 : -1;
                    transform.position += new Vector3(0, verti * speed * Time.deltaTime, 0);
                    if (verti == -1 ? transform.position.y <= goHere.y : transform.position.y >= goHere.y)
                    {
                        Vector3 result = transform.position;
                        result.y           = goHere.y;
                        transform.position = result;
                        moveHori           = true;
                    }
                }

                if (transform.position.x == goHere.x && transform.position.y == goHere.y)
                {
                    break;
                }
                yield return(null);
            }

            m_Animator.SetTrigger("Explosion");
            yield return(new WaitForSeconds(bombDelay));

            GetComponent <CircleCollider2D>().enabled = false;
            SendMessage("Play", "Bomb");
            cameraShake.Shake(0.5f, 0.4f);
            laserSpirteRenderer.color = new Color(1, 1, 1, 1);
            Collider2D[] _overlaps = Physics2D.OverlapBoxAll(transform.position, new Vector2(60, 1), 0f);
            foreach (Collider2D _c in _overlaps)
            {
                if (_c.tag == "Player")
                {
                    StatusManagement _status = _c.gameObject.GetComponent <StatusManagement>();
                    if (_status != null)
                    {
                        _status.GetDamage(damage, gameObject);
                    }
                }
            }
            _overlaps = Physics2D.OverlapBoxAll(transform.position, new Vector2(1, 60), 0f);
            foreach (Collider2D _c in _overlaps)
            {
                if (_c.tag == "Player")
                {
                    StatusManagement _status = _c.gameObject.GetComponent <StatusManagement>();
                    if (_status != null)
                    {
                        _status.GetDamage(damage, gameObject);
                    }
                }
            }

            float _color = 1;

            while (true)
            {
                yield return(null);

                _color -= Time.deltaTime;
                if (_color <= 0)
                {
                    laserSpirteRenderer.color = new Color(1, 1, 1, 0);
                    break;
                }
                laserSpirteRenderer.color = new Color(1, 1, 1, _color);
            }
            Destroy(gameObject);
        }
Пример #11
0
        IEnumerator Phase2Check()
        {
            LaserBackGround.localScale = new Vector3(1, 0, 1);
            Laser.color = new Color(1, 1, 1, 0);
            float _elapsed = laserShootDelay - 6;

            while (phase == 2 && !isDead)
            {
                yield return(null);

                _elapsed += Time.deltaTime;
                if (_elapsed >= laserShootDelay && !isRushing)
                {
                    LaserBackGround.localScale = new Vector3(1, 0, 1);
                    float alarmElapsed = 0;
                    SendMessage("Play", "Laser_Charge_1");
                    bool played1 = false;
                    bool played2 = false;

                    while (alarmElapsed <= laserAlarmTime)
                    {
                        if (alarmElapsed / laserAlarmTime >= 0.2f && !played1)
                        {
                            played1 = true;
                            SendMessage("Play", "Laser_Charge_2");
                        }
                        if (alarmElapsed / laserAlarmTime >= 0.4f && !played2)
                        {
                            played2 = true;
                            SendMessage("Play", "Laser_Charge_3");
                        }
                        yield return(null);

                        alarmElapsed += Time.deltaTime;
                        LaserBackGround.localScale += new Vector3(0, 3.3f / laserAlarmTime, 0) * Time.deltaTime;
                        if (LaserBackGround.localScale.y > 3.3f)
                        {
                            LaserBackGround.localScale = new Vector3(1, 3.3f, 1);
                            break;
                        }
                    }
                    LaserBackGround.localScale = new Vector3(1, 0, 1);

                    SendMessage("Play", "Laser_Shoot_1");
                    SendMessage("Play", "Laser_Shoot_2");
                    cameraShake.Shake(1f, 1.4f);
                    Laser.color = new Color(1, 1, 1, 1);
                    Collider2D[] _overlaps = Physics2D.OverlapBoxAll(LaserObject.transform.position, new Vector2(60, 1.66f * 2), 0f);
                    foreach (Collider2D _c in _overlaps)
                    {
                        if (_c.tag == "Player")
                        {
                            StatusManagement _status = _c.gameObject.GetComponent <StatusManagement>();
                            if (_status != null)
                            {
                                _status.GetDamage(laserDamage, gameObject);
                            }
                        }
                    }

                    float _color = 1;
                    while (true)
                    {
                        yield return(null);

                        _color -= Time.deltaTime / 2;
                        if (_color <= 0)
                        {
                            Laser.color = new Color(1, 1, 1, 0);
                            break;
                        }
                        Laser.color = new Color(1, 1, 1, _color);
                    }
                    //m_Animator.SetTrigger("Shoot");

                    _elapsed = 0;
                }
            }
        }
Пример #12
0
        IEnumerator Move()
        {
            bool moveLeftDown = Random.Range(0, 2) == 0 ? true : false;

            while (true)
            {
                float angle = (goHere.y - transform.position.y) / (goHere.x - transform.position.x);
                if (moveLeftDown)
                {
                    transform.position += new Vector3(-1, -1, 0).normalized *speed *Time.deltaTime;
                    if (angle <= -1)
                    {
                        moveLeftDown = false;
                    }
                }
                else
                {
                    transform.position += new Vector3(-1, 1, 0).normalized *speed *Time.deltaTime;
                    if (angle >= 1)
                    {
                        moveLeftDown = true;
                    }
                }
                if (transform.position.x <= goHere.x)
                {
                    transform.position = goHere;
                    break;
                }
                yield return(null);
            }

            m_Animator.SetTrigger("Explosion");
            yield return(new WaitForSeconds(bombDelay));

            SendMessage("Play", "Bomb");
            GetComponent <CircleCollider2D>().enabled = false;

            cameraShake.Shake(0.5f, 0.4f);
            laserSpirteRenderer.color = new Color(1, 1, 1, 1);
            Collider2D[] _overlaps = Physics2D.OverlapBoxAll(transform.position, new Vector2(60, 1), 45f);
            foreach (Collider2D _c in _overlaps)
            {
                if (_c.tag == "Player")
                {
                    StatusManagement _status = _c.gameObject.GetComponent <StatusManagement>();
                    if (_status != null)
                    {
                        _status.GetDamage(damage, gameObject);
                    }
                }
            }
            _overlaps = Physics2D.OverlapBoxAll(transform.position, new Vector2(1, 60), 45f);
            foreach (Collider2D _c in _overlaps)
            {
                if (_c.tag == "Player")
                {
                    StatusManagement _status = _c.gameObject.GetComponent <StatusManagement>();
                    if (_status != null)
                    {
                        _status.GetDamage(damage, gameObject);
                    }
                }
            }

            float _color = 1;

            while (true)
            {
                yield return(null);

                _color -= Time.deltaTime;
                if (_color <= 0)
                {
                    laserSpirteRenderer.color = new Color(1, 1, 1, 0);
                    break;
                }
                laserSpirteRenderer.color = new Color(1, 1, 1, _color);
            }
            Destroy(gameObject);
        }