Exemplo n.º 1
0
    public void ChangeHitting(float timeScale, float timeDelay, float duration, int perHp, List <string> partList)
    {
        if (invincible)
        {
            return;
        }

        hittingPartDic.Clear();
        for (int index = 0; index < partList.Count; ++index)
        {
            GameObject go = FindParentObject(partList[index]);
            if (go == null)
            {
                continue;
            }

            HittingPart part = new HittingPart();
            part.goBind = go;
            part.maxHp  = perHp;
            part.curHp  = perHp;
            hittingPartDic.Add(partList[index], part);
        }

        if (hittingPartDic.Count == 0)
        {
            return;
        }

        bulletTime = duration;
        StartCoroutine(OnCheckCompletePreposeAttackAction(timeScale, timeDelay, duration));
    }
Exemplo n.º 2
0
    public void OnSprayWaterHitting(GameObject go, int value)
    {
        if (!invincible)
        {
            return;
        }

        if (go != null)
        {
            if (hittingPartDic.ContainsKey(go.name))
            {
                HittingPart element = hittingPartDic[go.name];
                // 暂时先这样处理
                if (element.curHp > 0)
                {
                    Main.SoundController.PlayHitCircleSound();
                    EventDispatcher.TriggerEvent(GameEventDef.EVNET_DAMAGE_HITTING_UI, element.goBind);
                }
                element.curHp -= value;
                if (element.curHp <= 0)
                {
                    element.curHp = 0;
                }
                hittingPartDic[go.name] = element;
            }
            else
            {
                return;
            }
        }

        int hited = 0;

        foreach (KeyValuePair <string, HittingPart> element in hittingPartDic)
        {
            if (go == null)
            {
                element.Value.curHp -= value;
                if (element.Value.curHp <= 0)
                {
                    element.Value.curHp = 0;
                }
                hittingPartDic[element.Key] = element.Value;
            }

            if (element.Value.curHp == 0)
            {
                hited++;
            }
        }

        if (hited == hittingPartDic.Count)
        {
            if (!IsDie())
            {
                ChangeBreak();
            }
            OnSprayWater(GameConfig.GAME_CONFIG_WATER_DAMAGE_2, null);
        }
    }
Exemplo n.º 3
0
 public void RemoveHPFromAllHitPoint(HittingPart hp)
 {
     if (!mAllHittingPartList.Contains(hp))
     {
         return;
     }
     mAllHittingPartList.Remove(hp);
 }
Exemplo n.º 4
0
 public void AddHPToAllHitPoint(HittingPart hp)
 {
     if (mAllHittingPartList.Contains(hp))
     {
         return;
     }
     mAllHittingPartList.Add(hp);
 }
Exemplo n.º 5
0
    private void Pat()
    {
        Vector3 direction = ioo.cameraManager.position + Vector3.up * 4 - pterosaurBehaviour.transform.position;

        if (direction.magnitude <= 6.0f)
        {
            AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(0);
            if (!info.IsName("attack_pat"))
            {
                animator.SetInteger("State", 7);
            }
            else
            {
                if (info.normalizedTime > 0.3f && info.normalizedTime < 0.5f)
                {
                    animator.speed = 0.1f;
                    pterosaurBehaviour.ActiveBeat();
                }
                else if (info.normalizedTime >= 0.5f && info.normalizedTime < 0.9f)
                {
                    animator.speed = 1.0f;
                }
                else if (info.normalizedTime >= 0.9f)
                {
                    ToUpRush(E_PterosaurState.UpRush0);
                }
            }
        }
        else
        {
            pterosaurBehaviour.transform.position += direction.normalized * Time.deltaTime * 10;
        }

        if (pterosaurBehaviour.HPIsActive)
        {
            bool isBreak = true;
            for (int i = 0; i < pterosaurBehaviour.HPList.Count; ++i)
            {
                HittingPart hp = pterosaurBehaviour.HPList[i];
                if (hp.curHp > 0)
                {
                    isBreak = false;
                }
            }

            if (isBreak)
            {
                ToBeatBreak();
            }
        }
    }
Exemplo n.º 6
0
    private void Rain()
    {
        Vector3    direction  = ioo.cameraManager.position - pterosaurBehaviour.transform.position;
        Quaternion toRotation = Quaternion.LookRotation(direction);

        pterosaurBehaviour.transform.rotation = Quaternion.Lerp(pterosaurBehaviour.transform.rotation, toRotation, Time.deltaTime * pterosaurBehaviour.RotationSpeed);

        AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(0);

        if (!info.IsName("attack_rain"))
        {
            animator.SetInteger("State", 2);
        }
        else
        {
            if (info.normalizedTime >= 0.68f && info.normalizedTime < 0.95f)
            {
                animator.speed = 0.1f;
                pterosaurBehaviour.ActiveRain();
            }
            else if (info.normalizedTime >= 0.95f)
            {
                EventDispatcher.TriggerEvent(EventDefine.Summoned_Explosed);
                ToRainEnd();
            }
        }

        if (pterosaurBehaviour.HPIsActive)
        {
            bool isBreak = true;
            for (int i = 0; i < pterosaurBehaviour.HPList.Count; ++i)
            {
                HittingPart hp = pterosaurBehaviour.HPList[i];
                if (hp.curHp > 0)
                {
                    isBreak = false;
                }
            }

            if (isBreak)
            {
                ToRainEnd();
            }
        }
    }
Exemplo n.º 7
0
 public virtual void AddHittingPart(HittingPart hp)
 {
 }
Exemplo n.º 8
0
 public override void AddHittingPart(HittingPart hp)
 {
     hpList.Add(hp);
 }