private void LoadPlayerModelBack(BaseDisplay display) { var player = display as PlayerDisplay; //名称 GameObject name = NGUITools.AddChild(display.Controller.gameObject); player.ChangeDire(Directions.Right); BoxCollider2D boxCollider2D = player.BoxCollider2D; float y = (boxCollider2D.center.y + boxCollider2D.size.y * 0.5f) * display.GoCloth.transform.localScale.y; ; name.name = "name"; Transform mTrans = name.transform; mTrans.localPosition = new Vector3(0f, y + 0.2f, 0f); GameObject goName = HudView.Instance.AddItem(display.GetVo().Name, mTrans, HudView.Type.Player); (player.Controller as ActionControler).GoName = goName; if ((AppMap.Instance.mapParser.MapId == MapTypeConst.ARENA_MAP) || (AppMap.Instance.mapParser.MapId == MapTypeConst.GoldSilverIsland_MAP)) { display.Controller.AiController.SetAi(true); //英雄榜刚开始启用AI } else { display.Controller.AiController.SetAi(false); } if (SystemSettingMode.Instance.HidePlayer && MeVo.instance.mapId != MapTypeConst.ARENA_MAP && MeVo.instance.mapId != MapTypeConst.GoldSilverIsland_MAP) { //如果系统设置有设置隐藏玩家,则不显示玩家 display.GoBase.SetActive(false); display.Controller.GoName.SetActive(false); } if (display.GetMeVoByType <BaseRoleVo>().CurHp == 0) { display.Controller.StatuController.SetStatu(Status.DEATH); //血量为0时设置为死亡状态 } player.GetMeVoByType <PlayerVo>().UpdatePetDisplay(); }
private void LoadMonsterCallBack(BaseDisplay display) { var monsterVo = display.GetMeVoByType <MonsterVo>(); var mapRange = AppMap.Instance.mapParser.CurrentMapRange; if (monsterVo.X > (mapRange.MinX + mapRange.MaxX) / 2) { display.ChangeDire(Directions.Left); } else { display.ChangeDire(Directions.Right); } Log.info(this, string.Format("Monster Id : {0} Model Id: {1} Quality: {2}", monsterVo.MonsterVO.id, monsterVo.MonsterVO.res, monsterVo.MonsterVO.quality)); //为boss添加脚底特效 if (monsterVo.MonsterVO.quality == MonsterType.TypeBoss) { ShowBossFootEffect(display); //显示Boss预警特效 EffectMgr.Instance.CreateUIEffect(EffectId.UI_BossComingWarning, Vector3.zero); } //从空中产生怪物 if (monsterVo.bornType == (int)MonsterBornType.BornFromSky) { _monsterPresent = display; float x = GetRandomValueX(); float heroX = AppMap.Instance.me.GoBase.transform.position.x; int direction = x < heroX ? Directions.Right : Directions.Left; display.ChangeDire(direction); display.GoBase.transform.position = new Vector3(x, 6f, /*display.GoBase.transform.position.z*/ Random.Range(mapRange.MinY, mapRange.MaxY) * 5f);//由重力来完成掉落 display.Controller.MoveController.MonsterDrop(StartShowMonsterAdditionalView); StartShowMonsterAdditionalView(display); } else { StartShowMonsterAdditionalView(display); } }