Exemple #1
0
    public void LoadAttack(InventoryItem weapon, Vector3 forward, AttackDes att, MeteorUnit Owner)
    {
        owner      = Owner;
        _attack    = att;
        WeaponRoot = new GameObject().transform;
        WeaponRoot.SetParent(transform);
        WeaponRoot.localPosition    = Vector3.zero;
        WeaponRoot.localScale       = Vector3.one;
        WeaponRoot.localRotation    = Quaternion.Euler(0, 180, 90);
        WeaponRoot.name             = "WeaponRoot";
        WeaponRoot.gameObject.layer = gameObject.layer;
        Weapon = weapon;
        LoadWeapon();
        transform.LookAt(transform.position + forward);
        MeshRenderer mr = gameObject.GetComponentInChildren <MeshRenderer>();

        hitBox           = mr.gameObject.AddComponent <BoxCollider>();
        hitBox.isTrigger = true;
        hitBox.size      = new Vector3(6, 3, 6);

        _speed      = InitializeSpeed;
        velocity    = forward * InitializeSpeed;
        addVelocity = true;

        if (U3D.showBox)
        {
            BoundsGizmos.Instance.AddCollider(hitBox);
        }
        //取消这个对象和同队或者自己的碰撞
        if (owner != null)
        {
            owner.IgnoreOthers(hitBox);
        }
    }
Exemple #2
0
    //场景物件按照0点防御来算.
    int CalcDamage(MeteorUnit attacker, AttackDes attack = null)
    {
        //(((武器攻击力 + buff攻击力) x 招式攻击力) / 100) - (敌方武器防御力 + 敌方buff防御力) / 10
        //你的攻击力,和我的防御力之间的计算
        //attacker.damage.PoseIdx;
        if (GameStateMgr.Ins.gameStatus.EnableGodMode)
        {
            return(100000);
        }
        int       DefTmp = 0;
        AttackDes atk    = attacker.CurrentDamage;

        if (atk == null)
        {
            atk = attack;
        }
        if (atk == null)
        {
            Debug.LogError("CalcDamage can not find attackdes");
            return(1);
        }
        int WeaponDamage = attacker.CalcDamage();
        int PoseDamage   = MenuResLoader.Ins.FindOpt(atk.PoseIdx, 3).second[0].flag[6];
        int BuffDamage   = attacker.Attr.CalcBuffDamage();
        int realDamage   = Mathf.FloorToInt((((WeaponDamage + BuffDamage) * PoseDamage) / 100.0f - (DefTmp)));

        return(realDamage);
    }
    public void LoadAttack(InventoryItem weapon, Vector3 forward, AttackDes att, MeteorUnit Owner)
    {
        owner      = Owner;
        _attack    = att;
        WeaponRoot = new GameObject().transform;
        WeaponRoot.SetParent(transform);
        WeaponRoot.localPosition    = Vector3.zero;
        WeaponRoot.localScale       = Vector3.one;
        WeaponRoot.localRotation    = Quaternion.Euler(0, 180, 90);
        WeaponRoot.name             = "WeaponRoot";
        WeaponRoot.gameObject.layer = gameObject.layer;
        Weapon = weapon;
        LoadWeapon();
        transform.LookAt(transform.position + forward);
        MeshRenderer mr = gameObject.GetComponentInChildren <MeshRenderer>();

        if (mr != null)
        {
            BoxCollider bc = mr.gameObject.AddComponent <BoxCollider>();
            bc.isTrigger = true;
            bc.size      = new Vector3(2, 1, 6);
        }
        if (fly != null)
        {
            StopCoroutine(fly);
        }
        fly = StartCoroutine(Fly());
    }
    public static void Init(Vector3 spawn, Vector3 forw, InventoryItem weapon, AttackDes att, MeteorUnit owner)
    {
        GameObject dartObj = GameObject.Instantiate(ResMng.LoadPrefab("DartLoader"), spawn, Quaternion.identity, null) as GameObject;

        dartObj.layer = LayerMask.NameToLayer("Flight");
        DartLoader dart = dartObj.GetComponent <DartLoader>();

        dart.LoadAttack(weapon, forw, att, owner);
    }
 public void Init(MeteorUnit owner, AttackDes attDef)
 {
     AttackDef = attDef;
     Owner = owner;
     if (Owner != null) {
         Owner.IgnoreOthers(box);
         if (!Owner.HitList.Contains(this))
             Owner.HitList.Add(this);
     }
 }
 public void Init(SFXUnit SfxAttack, AttackDes attDef)
 {
     AttackDef = attDef;
     Attacker = SfxAttack;
     if (Attacker.mOwner != null) {
         Attacker.mOwner.IgnoreOthers(box);
         if (!Attacker.mOwner.HitList.Contains(this))
             Attacker.mOwner.HitList.Add(this);
     }
 }
Exemple #7
0
    //场景物件按照0点防御来算.
    int CalcDamage(MeteorUnit attacker)
    {
        //(((武器攻击力 + buff攻击力) x 招式攻击力) / 100) - (敌方武器防御力 + 敌方buff防御力) / 10
        //你的攻击力,和我的防御力之间的计算
        //attacker.damage.PoseIdx;
        int       DefTmp       = 0;
        AttackDes atk          = attacker.CurrentDamage;
        int       WeaponDamage = attacker.CalcDamage();
        int       PoseDamage   = MenuResLoader.Instance.FindOpt(atk.PoseIdx, 3).second[0].flag[6];
        int       BuffDamage   = attacker.Attr.CalcBuffDamage();
        int       realDamage   = Mathf.FloorToInt((((WeaponDamage + BuffDamage) * PoseDamage) / 100.0f - (DefTmp)));

        return(realDamage);
    }
Exemple #8
0
    public void OnDamage(MeteorUnit attacker, AttackDes attck = null)
    {
        int realDamage = CalcDamage(attacker, attck);

        //非铁箱子, 木箱子,酒坛, 桌子 椅子的受击处理
        if (MethodOnAttack != null)
        {
            MethodOnAttack.Invoke(CombatData.Ins.GScript, new object[] { InstanceId, attacker.InstanceId, realDamage });
        }
        else if (OnAttackCallBack != null)
        {
            OnAttackCallBack.Invoke(InstanceId, Index, realDamage);
        }
    }
    //LineRenderer line;
    public void LoadAttack(InventoryItem weapon, MeteorUnit target, AttackDes attackdef, MeteorUnit Owner)
    {
        //line = gameObject.AddComponent<LineRenderer>();
        //line.startWidth = 1f;
        //line.endWidth = 1f;
        //line.numPositions = 200;
        owner       = Owner;
        _attack     = attackdef;
        auto_target = target;
        WeaponRoot  = new GameObject().transform;
        WeaponRoot.SetParent(transform);
        WeaponRoot.localPosition    = Vector3.zero;
        WeaponRoot.localScale       = Vector3.one;
        WeaponRoot.localRotation    = Quaternion.Euler(0, 0, 0);
        WeaponRoot.name             = "WeaponRoot";
        WeaponRoot.gameObject.layer = gameObject.layer;
        Weapon = weapon;
        //计算控制点
        spline.SetControlPoint(0, transform.position);
        InitSpline();
        //List<Vector3> veclst = spline.GetEquiDistantPointsOnCurve(200);
        //line.SetPositions(veclst.ToArray());
        tTotal = spline.GetLength() / speed;
        //Debug.LogError("tTotal Init:" + tTotal + " length:" + spline.GetLength() + " speed:" + speed);
        LoadWeapon();
        //增加拖尾
        GameObject trailS = NodeHelper.Find("d_wpnRS", this.gameObject);
        GameObject trailE = NodeHelper.Find("d_wpnRE", this.gameObject);

        Trail = gameObject.AddComponent <WeaponTrail>();
        if (trailS != null)
        {
            Trail.AddTransform(trailS.transform);
        }
        if (trailE != null)
        {
            Trail.AddTransform(trailE.transform);
        }
        Trail.Init(Owner);
        Trail.Open();
        MeshRenderer mr = gameObject.GetComponentInChildren <MeshRenderer>();

        if (mr != null)
        {
            BoxCollider bc = mr.gameObject.AddComponent <BoxCollider>();
            bc.isTrigger = true;
            bc.size      = new Vector3(10, 5, 10);
        }
    }
    public void LoadAttack(InventoryItem weapon, Vector3 forward, AttackDes att, MeteorUnit Owner)
    {
        owner      = Owner;
        _attack    = att;
        WeaponRoot = new GameObject().transform;
        WeaponRoot.SetParent(transform);
        WeaponRoot.localPosition    = Vector3.zero;
        WeaponRoot.localScale       = Vector3.one;
        WeaponRoot.localRotation    = Quaternion.Euler(0, 180, 90);
        WeaponRoot.name             = "WeaponRoot";
        WeaponRoot.gameObject.layer = gameObject.layer;
        Weapon = weapon;
        LoadWeapon();
        transform.LookAt(transform.position + forward);
        MeshRenderer mr = gameObject.GetComponentInChildren <MeshRenderer>();

        BoxCollider bc = mr.gameObject.AddComponent <BoxCollider>();

        bc.isTrigger = true;
        bc.size      = new Vector3(6, 3, 6);

        velocity = forward * InitializeSpeed;
        Main.Ins.GameBattleEx.AddDamageCollision(owner, bc);
    }
 public void AddDamageCheck(MeteorUnit unit, AttackDes attackDef)
 {
     if (unit == null || unit.Dead)
     {
         return;
     }
     if (unit.GetWeaponType() == (int)EquipWeaponType.Gun)
     {
         Ray          r          = CameraFollow.Ins.m_Camera.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, DartLoader.MaxDistance));
         RaycastHit[] allHit     = Physics.RaycastAll(r, 3000, 1 << LayerMask.NameToLayer("Bone") | 1 << LayerMask.NameToLayer("Scene") | 1 << LayerMask.NameToLayer("Monster") | 1 << LayerMask.NameToLayer("LocalPlayer"));
         RaycastHit[] allHitSort = SortRaycastHit(allHit);
         //先排个序,从近到远
         for (int i = 0; i < allHitSort.Length; i++)
         {
             if (allHitSort[i].transform.gameObject.layer == LayerMask.NameToLayer("Scene"))
             {
                 break;
             }
             MeteorUnit unitAttacked = allHitSort[i].transform.gameObject.GetComponentInParent <MeteorUnit>();
             if (unitAttacked != null)
             {
                 if (unit.SameCamp(unitAttacked))
                 {
                     continue;
                 }
                 if (unitAttacked.Dead)
                 {
                     continue;
                 }
                 unitAttacked.OnAttack(unit, attackDef);
             }
         }
     }
     else
     {
         //飞镖,那么从绑点生成一个物件,让他朝
         //"Sphere3"是挂点
         //即刻生成一个物件飞出去。
         if (unit.charLoader.sfxEffect != null)
         {
             if (unit.GetWeaponType() == (int)EquipWeaponType.Dart)
             {
                 //飞镖.
                 Transform bulletBone = unit.charLoader.sfxEffect.FindEffectByName("Sphere_3");//出生点,
                 Vector3   vecSpawn   = bulletBone.position + 10 * Vector3.up;
                 Vector3   forw       = Vector3.zero;
                 if (unit.Attr.IsPlayer)
                 {
                     Vector3 vec = CameraFollow.Ins.m_Camera.ScreenToWorldPoint(new Vector3(Screen.width / 2, (Screen.height) / 2 + 75, DartLoader.MaxDistance));
                     forw = (vec - vecSpawn).normalized;
                 }
                 else
                 {
                     //敌人在未发现敌人时随便发飞镖?
                     if (unit.GetLockedTarget() == null)
                     {
                         forw = (-unit.transform.forward + new Vector3(Random.Range(1, 10), Random.Range(1, 10), Random.Range(1, 10))).normalized;//角色的面向
                     }
                     else
                     {
                         forw = (unit.GetLockedTarget().mPos - new Vector3(unit.mPos.x + Random.Range(1, 10), unit.mPos.y + Random.Range(1, 20), unit.mPos.z + Random.Range(1, 10))).normalized;//要加一点随机,否则每次都打一个位置不正常
                     }
                 }
                 //主角则方向朝着摄像机正前方
                 //不是主角没有摄像机,那么就看有没有目标,有则随机一个方向,根据与目标的包围盒的各个顶点的,判定这个方向
                 //得到武器模型,在指定位置出生.
                 InventoryItem weapon = unit.weaponLoader.GetCurrentWeapon();
                 DartLoader.Init(vecSpawn, forw, weapon, attackDef, unit);
             }
             else if (unit.GetWeaponType() == (int)EquipWeaponType.Guillotines)
             {
                 //隐藏右手的飞轮
                 unit.weaponLoader.HideWeapon();
                 //飞轮
                 Vector3       vecSpawn = unit.WeaponR.transform.position;
                 InventoryItem weapon   = unit.weaponLoader.GetCurrentWeapon();
                 if (unit.Attr.IsPlayer)
                 {
                     FlyWheel.Init(vecSpawn, autoTarget, weapon, attackDef, unit);
                 }
                 else
                 {
                     FlyWheel.Init(vecSpawn, unit.GetLockedTarget(), weapon, attackDef, unit);
                 }
             }
         }
     }
 }
Exemple #12
0
    public static void Init(Vector3 spawn, MeteorUnit autoTarget, InventoryItem weapon, AttackDes attackDef, MeteorUnit unit)
    {
        GameObject flyWheelObj = GameObject.Instantiate(Resources.Load("FlyWheel"), spawn, Quaternion.identity, null) as GameObject;

        flyWheelObj.layer = LayerMask.NameToLayer("Flight");
        FlyWheel wheel = flyWheelObj.GetComponent <FlyWheel>();

        wheel.LoadAttack(weapon, autoTarget, attackDef, unit);
    }
Exemple #13
0
 void ReadPose()
 {
     if (PosFile[UnitId] != null)
     {
         Pose      current = null;
         PosAction curAct  = null;
         AttackDes att     = null;
         DragDes   dra     = null;
         NextPose  nex     = null;
         int       left    = 0;
         int       leftAct = 0;
         int       leftAtt = 0;
         int       leftDra = 0;
         int       leftNex = 0;
         string    text    = System.Text.Encoding.ASCII.GetString(PosFile[UnitId].bytes);
         string[]  pos     = text.Split(new char[] { '\r', '\n' }, System.StringSplitOptions.RemoveEmptyEntries);
         for (int i = 0; i < pos.Length; i++)
         {
             if (current != null && current.Idx == 573)
             {
                 //Debug.Log("get");
             }
             string   line       = pos[i];
             string[] lineObject = line.Split(new char[] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries);
             if (lineObject.Length == 0)
             {
                 //Debug.Log("line i:" + i);
                 //空行跳过
                 continue;
             }
             else if (lineObject[0].StartsWith("#"))
             {
                 continue;
             }
             else
             if (lineObject[0] == "Pose" && left == 0 && leftAct == 0)
             {
                 Pose insert = new Pose();
                 ActionList[UnitId].Add(insert);
                 int idx = int.Parse(lineObject[1]);
                 insert.Idx = idx;
                 current    = insert;
             }
             else if (lineObject[0] == "{")
             {
                 if (nex != null)
                 {
                     leftNex++;
                 }
                 else
                 if (dra != null)
                 {
                     leftDra++;
                 }
                 else
                 if (att != null)
                 {
                     leftAtt++;
                 }
                 else
                 if (curAct != null)
                 {
                     leftAct++;
                 }
                 else
                 {
                     left++;
                 }
             }
             else if (lineObject[0] == "}")
             {
                 if (nex != null)
                 {
                     leftNex--;
                     if (leftNex == 0)
                     {
                         nex = null;
                     }
                 }
                 else
                 if (dra != null)
                 {
                     leftDra--;
                     if (leftDra == 0)
                     {
                         dra = null;
                     }
                 }
                 else
                 if (att != null)
                 {
                     leftAtt--;
                     if (leftAtt == 0)
                     {
                         att = null;
                     }
                 }
                 else
                 if (curAct != null)
                 {
                     leftAct--;
                     if (leftAct == 0)
                     {
                         curAct = null;
                     }
                 }
                 else
                 {
                     left--;
                     if (left == 0)
                     {
                         current = null;
                     }
                 }
             }
             else if (lineObject[0] == "link" || lineObject[0] == "Link" || lineObject[0] == "Link\t" || lineObject[0] == "link\t")
             {
                 current.Link = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "source" || lineObject[0] == "Source")
             {
                 current.SourceIdx = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "Start" || lineObject[0] == "start")
             {
                 if (nex != null)
                 {
                     nex.Start = int.Parse(lineObject[1]);
                 }
                 else
                 if (dra != null)
                 {
                     dra.Start = int.Parse(lineObject[1]);
                 }
                 else
                 if (att != null)
                 {
                     att.Start = int.Parse(lineObject[1]);
                 }
                 else
                 if (curAct != null)
                 {
                     curAct.Start = int.Parse(lineObject[1]);
                 }
                 else
                 {
                     current.Start = int.Parse(lineObject[1]);
                 }
             }
             else if (lineObject[0] == "End" || lineObject[0] == "end")
             {
                 if (nex != null)
                 {
                     nex.End = int.Parse(lineObject[1]);
                 }
                 else
                 if (dra != null)
                 {
                     dra.End = int.Parse(lineObject[1]);
                 }
                 else
                 if (att != null)
                 {
                     att.End = int.Parse(lineObject[1]);
                 }
                 else
                 if (curAct != null)
                 {
                     curAct.End = int.Parse(lineObject[1]);
                 }
                 else
                 {
                     current.End = int.Parse(lineObject[1]);
                 }
             }
             else if (lineObject[0] == "Speed" || lineObject[0] == "speed")
             {
                 if (curAct != null)
                 {
                     curAct.Speed = float.Parse(lineObject[1]);
                 }
             }
             else if (lineObject[0] == "LoopStart")
             {
                 current.LoopStart = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "LoopEnd")
             {
                 current.LoopEnd = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "EffectType")
             {
                 current.EffectType = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "EffectID")
             {
                 current.EffectID = lineObject[1];
             }
             else if (lineObject[0] == "Blend")
             {
                 PosAction act = new PosAction();
                 act.Type = "Blend";
                 current.ActionList.Add(act);
                 curAct = act;
             }
             else if (lineObject[0] == "Action")
             {
                 PosAction act = new PosAction();
                 act.Type = "Action";
                 current.ActionList.Add(act);
                 curAct = act;
             }
             else if (lineObject[0] == "Attack")
             {
                 att         = new AttackDes();
                 att.PoseIdx = current.Idx;
                 current.Attack.Add(att);
             }
             else if (lineObject[0] == "bone")
             {
                 //重新分割,=号分割,右边的,号分割
                 lineObject = line.Split(new char[] { '=' }, System.StringSplitOptions.RemoveEmptyEntries);
                 string bones = lineObject[1];
                 while (bones.EndsWith(","))
                 {
                     i++;
                     lineObject    = new string[1];
                     lineObject[0] = pos[i];
                     bones        += lineObject[0];
                 }
                 //bones = bones.Replace(' ', '_');
                 string[] bonesstr = bones.Split(new char[] { ',' });
                 for (int j = 0; j < bonesstr.Length; j++)
                 {
                     string b = bonesstr[j].TrimStart(new char[] { ' ', '\"' });
                     b = b.TrimEnd(new char[] { '\"', ' ' });
                     b = b.Replace(' ', '_');
                     att.bones.Add(b);
                 }
             }
             else if (lineObject[0] == "AttackType")
             {
                 att._AttackType = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "CheckFriend")
             {
                 att.CheckFriend = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "DefenseValue")
             {
                 att.DefenseValue = float.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "DefenseMove")
             {
                 att.DefenseMove = float.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "TargetValue")
             {
                 att.TargetValue = float.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "TargetMove")
             {
                 att.TargetMove = float.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "TargetPose")
             {
                 att.TargetPose = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "TargetPoseFront")
             {
                 att.TargetPoseFront = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "TargetPoseBack")
             {
                 att.TargetPoseBack = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "TargetPoseLeft")
             {
                 att.TargetPoseLeft = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "TargetPoseRight")
             {
                 att.TargetPoseRight = int.Parse(lineObject[1]);
             }
             else if (lineObject[0] == "Drag")
             {
                 dra          = new DragDes();
                 current.Drag = dra;
             }
             else if (lineObject[0] == "Time")
             {
                 if (nex != null)
                 {
                     nex.Time = float.Parse(lineObject[1]);
                 }
                 else
                 {
                     dra.Time = float.Parse(lineObject[1]);
                 }
             }
             else if (lineObject[0] == "Color")
             {
                 string[] rgb = lineObject[1].Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
                 dra.Color.x = int.Parse(rgb[0]);
                 dra.Color.y = int.Parse(rgb[1]);
                 dra.Color.z = int.Parse(rgb[2]);
             }
             else if (lineObject[0] == "NextPose")
             {
                 current.Next = new NextPose();
                 nex          = current.Next;
             }
             else if (lineObject[0] == "{}")
             {
                 current = null;
                 continue;
             }
             else
             {
                 Debug.Log("line :" + i + " can t understand:" + pos[i]);
                 break;
             }
         }
     }
 }
Exemple #14
0
    //力量感很差,仅仅运行轨迹是一条曲线还是不行的。要有冲击感,要做变速/匀加速按固定轨迹运动,才行
    //因为贝塞尔通过时间计算曲线的某一位置,可以把时间参数模拟加快,做为变量
    //但是怎么去控制
    //LineRenderer line;
    public void LoadAttack(InventoryItem weapon, MeteorUnit target, AttackDes attackdef, MeteorUnit Owner)
    {
        //line = gameObject.AddComponent<LineRenderer>();
        //line.startWidth = 1f;
        //line.endWidth = 1f;
        //line.numPositions = 200;
        if (attackdef != null)
        {
            if (attackdef.PoseIdx == 218)
            {
                //轻力度
                speed = (normal_speed + max_speed) / 2;
            }
            else if (attackdef.PoseIdx == 220)
            {
                //中等力度
                speed = (middle_speed + max_speed) / 2;
            }
            else if (attackdef.PoseIdx == 222)
            {
                //超级力度
                speed = (super_speed + max_speed) / 2;
            }
        }
        owner       = Owner;
        _attack     = attackdef;
        auto_target = target;
        WeaponRoot  = new GameObject().transform;
        WeaponRoot.SetParent(transform);
        WeaponRoot.localPosition    = Vector3.zero;
        WeaponRoot.localScale       = Vector3.one;
        WeaponRoot.localRotation    = Quaternion.Euler(0, 0, 0);
        WeaponRoot.name             = "WeaponRoot";
        WeaponRoot.gameObject.layer = gameObject.layer;
        Weapon = weapon;
        //计算控制点
        spline.SetControlPoint(0, transform.position);
        InitSpline();
        //List<Vector3> veclst = spline.GetEquiDistantPointsOnCurve(200);
        //line.SetPositions(veclst.ToArray());
        totalTime = spline.GetLength() / speed;
        //float a = (max_speed - speed) / totalTime;
        //Debug.LogError("tTotal Init:" + tTotal + " length:" + spline.GetLength() + " speed:" + speed);
        LoadWeapon();
        //增加拖尾
        GameObject trailS = NodeHelper.Find("d_wpnRS", this.gameObject);
        GameObject trailE = NodeHelper.Find("d_wpnRE", this.gameObject);

        Trail = gameObject.AddComponent <WeaponTrail>();
        if (trailS != null)
        {
            Trail.AddTransform(trailS.transform);
        }
        if (trailE != null)
        {
            Trail.AddTransform(trailE.transform);
        }
        Trail.Init(Owner);
        Trail.Open();
        MeshRenderer mr = gameObject.GetComponentInChildren <MeshRenderer>();

        if (mr != null)
        {
            BoxCollider hitBox = mr.gameObject.AddComponent <BoxCollider>();
            hitBox.isTrigger = true;
            hitBox.size      = new Vector3(10, 5, 10);
            if (U3D.showBox)
            {
                BoundsGizmos.Instance.AddCollider(hitBox);
            }
        }
    }