Ejemplo n.º 1
0
    //攻击方法
    void Attacking()
    {
        //所有判断都通过了,可以攻击
        if (AttackCheck())
        {
            //根据距离重新计算arc,距离越远arc越小,且整个子弹扇面不会超过180度
            float temparc = S.S[K.BulletArc].Get() * 5f / m_TargetDistance;
            if (temparc * (S.S[K.BulletCount].GetInt() - 1) > 180f)
            {
                temparc = 180f / (S.S[K.BulletCount].GetInt() - 1);
            }
            //Debug.LogFormat("temparc:{0} , m_TargetDistance:{1}", temparc, m_TargetDistance); //修正一过房间怪物还没刷出来的时候就尝试攻击会报错的bug的时候加的log,后来发现是因为m_TargetDistance作为被除数,当没有怪物的时候值为0导致的bug
            //发射飞弹
            for (int i = 0; i < S.S[K.BulletCount].GetInt(); i++)
            {
                GameObject _newbullet = GameObject.Instantiate(m_BulletPrefab, gameObject.transform.position, Quaternion.identity);
                _newbullet.transform.LookAt(m_TargetList[0].transform);
                _newbullet.transform.Rotate(0, -(S.S[K.BulletCount].GetInt() - 1) / 2 * temparc, 0);
                _newbullet.transform.Rotate(0, i * temparc, 0);
                _newbullet.GetComponent <Rigidbody>().velocity          = _newbullet.transform.forward * S.S[K.BulletSpeed].Get();
                _newbullet.GetComponent <BulletController>().SourceUnit = gameObject;
            }
            //CD清零,扣蓝
            m_AttackCurrentCoolDown = 0f;
            m_HPControllerPlayer.LoseMP(S.S[K.BulletMPCost].Get());

            //更新UI
            PlayerMPBarController.SetBarValue(m_HPControllerPlayer.GetCurrentMP() / S.S[K.MaxMP].Get());

            //测试Buff
            //Buff.AddBuff(S, 3f, new StatusModifier(K.BulletCount, 1, 0, 0));
        }
    }
Ejemplo n.º 2
0
 protected override void Update()
 {
     base.Update();
     PlayerHPBarController.SetBarValue(GetCurrentHP() / POEStatics.PlayerPOEStatus.S[K.MaxHP].Get());
     PlayerMPBarController.SetBarValue(GetCurrentMP() / POEStatics.PlayerPOEStatus.S[K.MaxMP].Get());
 }
Ejemplo n.º 3
0
 private void Start()
 {
     PlayerEXPBarController.SetBarValue(0f);
     PlayerLevelText.text = POEStatics.Const.InitLevel.ToString();
 }