コード例 #1
0
 private void SetUVPosition(int nNumberCount, int nDamage, bool bDodge, NkBattleDamage.eDAMAGEMODE eMode)
 {
     if (bDodge)
     {
         return;
     }
     char[] array = nDamage.ToString().ToCharArray();
     for (int i = 0; i < nNumberCount; i++)
     {
         int       num     = int.Parse(array[i].ToString());
         string    strName = string.Format("number{0}", (i + 1).ToString());
         Transform child   = NkUtil.GetChild(this.m_goFxFont.transform, strName);
         if (child != null)
         {
             GameObject gameObject = child.gameObject;
             if (gameObject)
             {
                 Rect rect = new Rect(NkBattleDamage.m_rtDamage[(int)eMode]);
                 rect.x += rect.width * (float)num;
                 Vector2[] uv = new Vector2[]
                 {
                     new Vector2(rect.x, rect.y),
                     new Vector2(rect.x + rect.width, rect.y - rect.height),
                     new Vector2(rect.x, rect.y - rect.height),
                     new Vector2(rect.x + rect.width, rect.y)
                 };
                 MeshFilter component = gameObject.GetComponent <MeshFilter>();
                 if (component != null)
                 {
                     component.mesh.uv = uv;
                 }
             }
         }
     }
 }
コード例 #2
0
    public void Set(NkBattleChar pkTarget, int nDamage, bool bCritical, int nAngerlyPoint, int nInfoNum)
    {
        this.m_eDamageMode   = NkBattleDamage.eDAMAGEMODE.eDAMAGEMODE_NORMAL;
        this.m_TargetChar    = pkTarget;
        this.m_nBattleCharID = pkTarget.GetID();
        this.m_bDodge        = false;
        this.m_bSetData      = true;
        int num = 0;

        if (this.m_goDamageRoot == null)
        {
            this.m_goDamageRoot = (UnityEngine.Object.Instantiate(Battle.BATTLE.DamageEffect) as GameObject);
            this.m_goDamageRoot.SetActive(true);
            this.m_goDamageRoot.transform.parent = NkBattleDamage.goDamageParent.transform;
        }
        else
        {
            this.m_goDamageRoot.SetActive(true);
        }
        if (this.m_goFxFont == null)
        {
            this.m_goFxFont = NkUtil.GetChild(this.m_goDamageRoot.transform, "fx_font").gameObject;
        }
        if (this.m_goCritical == null)
        {
            this.m_goCritical = NkUtil.GetChild(this.m_goDamageRoot.transform, "fx_critical").gameObject;
        }
        if (this.m_goCritical != null)
        {
            this.m_goCritical.SetActive(false);
        }
        if (this.m_goDamageNumber == null)
        {
            this.m_goDamageNumber = NkUtil.GetChild(this.m_goDamageRoot.transform, "damagenumber").gameObject;
        }
        if (nDamage == 0 && nAngerlyPoint == 0)
        {
            this.m_bDodge = true;
        }
        else
        {
            if (nDamage < 0)
            {
                nDamage           *= -1;
                this.m_eDamageMode = NkBattleDamage.eDAMAGEMODE.eDAMAGEMODE_NORMAL;
            }
            else if (nAngerlyPoint > 0)
            {
                nDamage            = nAngerlyPoint;
                this.m_eDamageMode = NkBattleDamage.eDAMAGEMODE.eDAMAGEMODE_ANGERLYPOINT;
            }
            else
            {
                this.m_eDamageMode = NkBattleDamage.eDAMAGEMODE.eDAMAGEMODE_HEAL;
            }
            char[] array = nDamage.ToString().ToCharArray();
            num = array.Length;
            if (num > NkBattleDamage.nMaxCount)
            {
                num = NkBattleDamage.nMaxCount;
            }
            switch (nInfoNum)
            {
            case 1:
                this.m_eInfoMode   = NkBattleDamage.eINFOMODE.eINFOMODE_SLEEP;
                this.m_eDamageMode = NkBattleDamage.eDAMAGEMODE.eDAMAGEMODE_STUN;
                break;

            case 2:
                this.m_eInfoMode   = NkBattleDamage.eINFOMODE.eINFOMODE_SILENCE;
                this.m_eDamageMode = NkBattleDamage.eDAMAGEMODE.eDAMAGEMODE_STUN;
                break;

            case 3:
                this.m_eInfoMode   = NkBattleDamage.eINFOMODE.eINFOMODE_STUN;
                this.m_eDamageMode = NkBattleDamage.eDAMAGEMODE.eDAMAGEMODE_STUN;
                break;

            case 4:
                this.m_eInfoMode   = NkBattleDamage.eINFOMODE.eINFOMODE_BLIND;
                this.m_eDamageMode = NkBattleDamage.eDAMAGEMODE.eDAMAGEMODE_STUN;
                break;

            default:
                this.m_eInfoMode = NkBattleDamage.eINFOMODE.eINFOMODE_EMPTY;
                break;
            }
            if (bCritical)
            {
                this.m_eDamageMode = NkBattleDamage.eDAMAGEMODE.eDAMAGEMODE_CRITICAL;
                Battle.BATTLE.BattleCamera.CameraAnimationPlay("vibration01");
            }
            this.SetUVPosition(num, nDamage, this.m_bDodge, this.m_eDamageMode);
        }
        this.fStartTime = Time.time;
        this.UpdatePosition();
        this.PlayAnimation(num, this.m_bDodge);
    }