Ejemplo n.º 1
0
    private void Update()
    {
        if (BrickManager.Instance.IsLoaded && !bDie && (MyInfoManager.Instance.Seq == RoomManager.Instance.Master || readyP2P != 0))
        {
            if (MyInfoManager.Instance.Seq == RoomManager.Instance.Master)
            {
                vCur = UpdateAI();
            }
            else
            {
                vCur = UpdateAIP2P();
            }
            base.transform.position = vCur;
            CheckPositionPrev();
            if (bHitMark)
            {
                timerHitMark += Time.deltaTime;
                float num = timerHitMark;
                num *= 4f;
                if (num > 1f)
                {
                    num = 2f - num;
                }
                float    num2     = Mathf.Lerp(0f, orgColor.g, num);
                float    num3     = Mathf.Lerp(0f, orgColor.b, num);
                Material material = smr.material;
                float    g        = orgColor.g - num2;
                float    b        = orgColor.b - num3;
                Color    color    = smr.material.color;
                material.color = new Color(1f, g, b, color.a);
                if (timerHitMark > 0.5f)
                {
                    Material material2 = smr.material;
                    float    r         = orgColor.r;
                    float    g2        = orgColor.g;
                    float    b2        = orgColor.b;
                    Color    color2    = smr.material.color;
                    material2.color = new Color(r, g2, b2, color2.a);
                    bHitMark        = false;
                }
            }
            if (MyInfoManager.Instance.Seq == RoomManager.Instance.Master && readyP2P == 2)
            {
                timerSendP2PMove += Time.deltaTime;
                if (timerSendP2PMove >= 0.4f)
                {
                    timerSendP2PMove = 0f;
                    P2PManager instance = P2PManager.Instance;
                    int        seq      = monProp.Desc.Seq;
                    float      x        = vCur.x;
                    float      y        = vCur.y;
                    float      z        = vCur.z;
                    Vector3    forward  = base.transform.forward;
                    float      x2       = forward.x;
                    Vector3    forward2 = base.transform.forward;
                    float      y2       = forward2.y;
                    Vector3    forward3 = base.transform.forward;
                    instance.SendPEER_MON_MOVE(seq, x, y, z, x2, y2, forward3.z);
                }
            }
            CheckColHit();
            CheckHit();
            if (eff != null)
            {
                eff.transform.position = base.transform.position;
            }
            switch (monType)
            {
            case MON_TYPE.FLASH:
                updateSkill();
                break;

            case MON_TYPE.HIDE:
                updateHide();
                break;

            case MON_TYPE.HEAL:
                updateSelfHeal();
                break;

            case MON_TYPE.BOSS:
                updateAreaHeal();
                break;
            }
            if (bArrived)
            {
                MonProperty component = GetComponent <MonProperty>();
                if (component.Desc.tblID == 4)
                {
                    MonManager.Instance.BossUnVisibleAll(component.Desc.bRedTeam);
                }
                if (MyInfoManager.Instance.Seq == RoomManager.Instance.Master)
                {
                    P2PManager.Instance.SendPEER_MON_DIE(component.Desc.Seq, arrived: true);
                    if (component.Desc.bRedTeam)
                    {
                        DefenseManager.Instance.CoreLifeBlue -= monProp.Desc.coreToDmg;
                    }
                    else
                    {
                        DefenseManager.Instance.CoreLifeRed -= monProp.Desc.coreToDmg;
                    }
                    CSNetManager.Instance.Sock.SendCS_CORE_HP_REQ(DefenseManager.Instance.CoreLifeRed, DefenseManager.Instance.CoreLifeBlue);
                }
                MonManager.Instance.Remove(component.Desc.Seq);
                bDie = true;
            }
        }
    }