예제 #1
0
 //显示陷阱
 private void ShowTrap()
 {
     string[] trapList = StringUtils.SplitVoString(MapVo.trapList, "],[");
     for (int i = 0; i < trapList.Length; i++)
     {
         string[] trapInfo = StringUtils.SplitVoString(trapList[i]);
         if (trapInfo.Length == 1)
         {
             continue;
         }
         if (trapInfo.Length < 3)
         {
             Log.error(this, "地图陷阱Trap信息配置错误,地图id" + MapVo.id);
             continue;
         }
         uint id     = uint.Parse(trapInfo[0]);
         var  trapVo = new TrapVo
         {
             Id = id,
             X  = float.Parse(trapInfo[1]),
             Y  = float.Parse(trapInfo[2]),
             ModelLoadCallBack = LoadTrapBack,
             Type   = DisplayType.Trap,
             TrapId = id
         };
         AppMap.Instance.CreateTrap(trapVo);
     }
 }
예제 #2
0
 // Use this for initialization
 private void Start()
 {
     ActionControler.StatuController.SetStatu(Status.IDLE);
     TrapMeDisplay = ActionControler.Me as TrapDisplay;
     ThisTrapVo    = TrapMeDisplay.GetTrapVo();
     vp_Timer.In(ThisTrapVo.SysTrapVo.AttackInterval * 0.001f, ActionAttack);
 }
예제 #3
0
        // Use this for initialization
        private void Start()
        {
            ActionControler.StatuController.SetStatu(Status.IDLE);
            TrapMeDisplay             = ActionControler.Me as TrapDisplay;
            ThisTrapVo                = TrapMeDisplay.GetTrapVo();
            _skillBaseVo              = BaseDataMgr.instance.GetSysSkillBaseVo(uint.Parse(StringUtils.GetValueListFromString(ThisTrapVo.SysTrapVo.SkillIds)[0]));
            LastAttackedActionDisplay = new List <ActionDisplay>();
            _startTime                = 0;
            Vector3 pos = transform.position;

            EffectMgr.Instance.CreateMainEffect(EffectId.Main_CylinderStandby, pos, true, null, false);
        }
예제 #4
0
    // Update is called once per frame
    void Update()
    {
        foreach (GameObject trapobj in trapDataObject.Keys)
        {
            TrapVo trap = trapDataObject[trapobj];
            if (trap.type == 2)
            {
                MonsterRefreshVo trapvo = trap as MonsterRefreshVo;
                if (trapvo.curLiveEnemy < trapvo.maxLiveEnemy)
                {
                    trapvo.currefreshindex++;
                    if (trapvo.currefreshindex >= trapvo.refreshCD * 5)
                    {
                        trapvo.curLiveEnemy++;
                        Notice.EnemyCreat.broadcast("", trapObject[trap.id]);
                        trapvo.currefreshindex = 0;
                    }
                }
            }
            else if (trap.type == 3)
            {
                AtkOffice trapvo = trap as AtkOffice;
                trapvo.curcd++;
                if (trapvo.curcd >= trapvo.atkCD)
                {
                    trapvo.curcd = 0;

                    GameObject obj = GameObject.Instantiate((GameObject)Resources.Load("Prefabs/ShootCollisoon 1"), trapObject[trap.id].transform.position, trapObject[trap.id].transform.rotation);
                    obj.tag = "trap";
                    obj.GetComponent <ShootCollisoon>().initdata(trapvo.rang / trapvo.speed);
                    obj.transform.Translate(new Vector3(0, 0.5f, 0));
                    obj.GetComponent <Rigidbody>().AddForce(obj.transform.forward * 1000);
                    obj.transform.SetParent(trapObject[trap.id].transform);
                }
            }
            else if (trap.type == 7)
            {
                TrapSpring trapvo = trap as TrapSpring;
                if (trapvo.isshrink)
                {
                    //Debug.Log(trapvo.curRange);
                    trapvo.curRange -= 0.5f;
                    if (trapvo.curRange <= 0)
                    {
                        foreach (Transform child in trapobj.transform)
                        {
                            if (child.GetComponent <TrapCollisoon>())
                            {
                                if (child.GetComponent <TrapCollisoon>().use == "trigger")
                                {
                                    // Destroy(child.gameObject);
                                }
                                else
                                {
                                    trapvo.isshrink = false;
                                    trapvo.curRange = -1;
                                    Destroy(child.gameObject);
                                }
                            }
                        }
                    }
                    else
                    {
                        foreach (Transform child in trapobj.transform)
                        {
                            if (child.GetComponent <TrapCollisoon>())
                            {
                                if (child.GetComponent <TrapCollisoon>().use == "trigger")
                                {
                                    // Destroy(child.gameObject);
                                }
                                else
                                {
                                    child.transform.localScale = new Vector3(trapvo.curRange, 0.1f, 1);
                                    child.transform.Translate(new Vector3(0.25f, 0, 0));
                                }
                            }
                        }
                    }
                }
                else if (trapvo.curRange != -1)
                {
                    if (trapvo.curRange < trapvo.range)
                    {
                        trapvo.curRange += 0.5f;
                        foreach (Transform child in trapobj.transform)
                        {
                            if (child.GetComponent <TrapCollisoon>())
                            {
                                if (child.GetComponent <TrapCollisoon>().use == "trigger")
                                {
                                    // Destroy(child.gameObject);
                                }
                                else
                                {
                                    child.transform.localScale = new Vector3(trapvo.curRange, 0.1f, 1);
                                    child.transform.Translate(new Vector3(-0.25f, 0, 0));
                                }
                            }
                        }
                    }
                    else
                    {
                        trapvo.isshrink = true;
                    }
                }
            }
        }
    }