Exemplo n.º 1
0
    /// <summary>
    /// 创建战斗角色模型
    /// </summary>
    private void CreateBattleModel()
    {
        _heroObject = new List <LYXHeroObject>();

        for (int i = 0, len = _heroEntityList.Count; i < len; i++)
        {
            LYXHeroEntity own       = _heroEntityList[i];
            LYXHeroObject ownObject = LCSCompHelper.LoadResource <LYXHeroObject>("RoleModel/" + own.HeroModel);
            if (ownObject == null)
            {
                continue;
            }
            ownObject.mHeroEnity  = own;
            ownObject.mMoveEndPos = mEndMovePos;
            string parPath = own.FriendAndFoe == 1 ? "own" : "enemy";
            InitHeroObjectPosition(ownObject.transform, parPath + "/" + own.HeroPos);
            if (own.FriendAndFoe == 1)
            {
                ownObject.transform.localScale = new Vector3(-1, 1, 1);
            }
            ownObject.mBatManage = this;
            _heroObject.Add(ownObject);
        }

        _isIntoBattle = true;
    }
Exemplo n.º 2
0
    /// <summary>
    /// 创建伤害值
    /// </summary>
    /// <param name="parent">父节点</param>
    /// <param name="target">伤害值位置</param>
    /// <param name="hurtValue">伤害值</param>
    /// <param name="offect">便宜位置</param>
    /// <returns></returns>
    public static LYXBattleBuffer CreateHarm(GameObject parent, GameObject target, float hurtValue, Vector3 offect)
    {
        LYXBattleBuffer buffer = LCSCompHelper.LoadResource <LYXBattleBuffer>("Prefab/hurtvalue");
        UILabel         lab    = buffer.GetComponent <UILabel>();

        if (lab == null)
        {
            return(null);
        }
        lab.text = "[ff0000] -" + hurtValue;
        Transform trans = lab.transform;

        trans.parent        = parent.transform;
        trans.localPosition = Vector3.zero;
        trans.localRotation = Quaternion.identity;
        trans.localScale    = Vector3.one;
        trans.position      = target.transform.position;
        trans.localPosition = trans.localPosition + offect;
        return(buffer);
    }