public void GenerateEmployee(EmployeeInfoVO employeeVO) { //设置出生点和消失点 int bornPointIndex = Random.Range(0, 4); Vector3 bornPoint = bornPoints[bornPointIndex].transform.position; Vector3 disappearPoint = disappearPoints[bornPointIndex].transform.position; GameObject employee = CatPool.GetInstance().GetCatPool(employeeVO.Id).CreateObject(bornPoint); EmployeeCtl employeeCtl = employee.AddComponent <EmployeeCtl>(); employeeCtl.bornPosition = bornPoint; employeeCtl.disappearPosition = disappearPoint; EmployeeInfo employeeInfo = employee.AddComponent <EmployeeInfo>(); employeeInfo.Id = employeeVO.Id; employeeInfo.Name = employeeVO.Name; employeeInfo.Level = employeeVO.Level; employeeInfo.Evo = employeeVO.Evo; employeeInfo.Iq = employeeVO.Iq; employeeInfo.Atk = employeeVO.Atk; employeeInfo.React = employeeVO.React; employeeInfo.Skill = employeeVO.Skill; employeeInfo.About = employeeVO.About; employeeInfo.Hireprice = employeeVO.HirePrice; }
/// <summary> /// 展示当前的猫分组 /// </summary> public void ShowCurrentCatGroup(object data) { CatPool.GetInstance().DestructAll(); prefabslist.Clear(); //每次展示队伍前 ,清理上次的展示队伍 JsonData cats = (JsonData)data; int count = (int)cats["count"]; for (int i = 0; i < count; i++) { Debug.Log(" cat count" + count); JsonData catinfo = cats[i]; int cattype = (int)catinfo["cattypeid"]; prefabslist.Add(CatPool.GetInstance().GetCatPool(cattype).CreateObject(Grid.transform.GetChild(i).transform.position)); prefabslist[i].layer = 5; prefabslist[i].transform.SetChildLayer(5); /* Vector3 prefabsize = prefabs.GetComponent<CharacterController>().bounds.size; * Vector3 Reallyszie = new Vector3(); * Reallyszie.x = prefabs.transform.localScale.x * prefabsize.x; * Reallyszie.y = prefabs.transform.localScale.y * prefabsize.y; * Reallyszie.z = prefabs.transform.localScale.z * prefabsize.z; * Debug.Log(Reallyszie); * float sizex= Grid.transform.GetChild(i).GetComponent<UISprite>().localSize.x; * float sizey = Grid.transform.GetChild(i).GetComponent<UISprite>().localSize.y; * Debug.Log(Grid.transform.GetChild(i).GetComponent<UISprite>().localSize); * float offsety = Reallyszie.y/2; */ prefabslist[i].transform.position = new Vector3(prefabslist[i].transform.position.x, -0.25f, -0.1f); prefabslist[i].transform.eulerAngles = new Vector3(0, 180, 0); prefabslist[i].transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); prefabslist[i].AddComponent <BattleDisplayAnimator>(); } }
private void ShowEmployeeInfo(GameObject go) { EmployeeInfo employeeInfo = go.GetComponent <EmployeeInfo>(); EmployeeMediator employeeMediator = AppFacade.getInstance.RetrieveMediator(EmployeeMediator.NAME) as EmployeeMediator; _employeeview = employeeMediator.employeeView; _employeeview.employeesussce = false; _employeeview.currentClickCatInfo = employeeInfo; _employeeview.employPanel.SetActive(true); GameObject employee = CatPool.GetInstance().GetCatPool(employeeInfo.Id).CreateObject(_employeeview.catPosition.transform.position); employee.AddComponent <EmployeeRandomAnimation>(); employee.layer = 9; employee.transform.SetChildLayer(9); employee.transform.rotation = _employeeview.catPosition.transform.rotation; employee.transform.parent = _employeeview.catPosition.transform; _employeeview.eName.text = employeeInfo.Name + " 来应聘了!"; _employeeview.eLevel.text = "等级:" + employeeInfo.Level.ToString(); _employeeview.eIq.text = "智力:" + employeeInfo.Iq.ToString(); _employeeview.eAtk.text = "攻击力:" + employeeInfo.Atk.ToString(); _employeeview.eReact.text = "反应力:" + employeeInfo.React.ToString(); _employeeview.eSkill.text = "拥有技能:" + employeeInfo.Skill.ToString(); _employeeview.eHireprice.text = "佣金:" + employeeInfo.Hireprice.ToString(); }
private int[] mCurrentCats = new int[] { 5, 6, 7 }; //做好prefab的猫id 临时存储 public static CatPool GetInstance() { if (mInstance == null) { mInstance = GameObject.Find("CatPool").GetComponent <CatPool>(); } return(mInstance); }
private void Awake() { if (instance != null) { Destroy(this); } else { instance = this; } }
public void GenerateCustomer(CustomerInfoVO customerVO) { GameObject customer = CatPool.GetInstance().GetCatPool(customerVO.Id).CreateObject(spawnObject.transform.position); CustomerCtl customerCtl = customer.AddComponent <CustomerCtl>(); customerCtl.jumpStartObject = jumpStartObject; customerCtl.jumpEndObject = jumpEndObject; customerCtl.centerObject = centerObject; customerCtl.goAwayObjects = goAwayObjects; CustomerInfo customerInfo = customer.AddComponent <CustomerInfo>(); customerInfo.Money = customerVO.Money; customerLists.Add(customer); }
private void ShowCatInfo(GameObject sender) { if (sender == null) { for (int i = 0; i < infoPanel.transform.childCount; i++) { infoPanel.transform.GetChild(i).gameObject.SetActive(false); } CancelBtn.SetActive(true); return; } else { for (int i = 0; i < infoPanel.transform.childCount; i++) { infoPanel.transform.GetChild(i).gameObject.SetActive(true); } } CatInfo cat = sender.GetComponent <CatInfo>(); Transform modelpos = infoPanel.transform.Find("ModelPos").GetComponent <Transform>(); if (modelpos.childCount > 0) { GameObject catmodelbefore = modelpos.GetChild(0).gameObject; catmodelbefore.layer = 8; catmodelbefore.transform.SetChildLayer(8); Destroy(catmodelbefore.GetComponent <EmployeeRandomAnimation>()); catmodelbefore.SetActive(false); } GameObject catmodel = CatPool.GetInstance().GetCatPool(cat.CatTypeid).CreateObject(modelpos.position); catmodel.layer = 9; catmodel.transform.SetChildLayer(9); catmodel.AddComponent <EmployeeRandomAnimation>(); catmodel.transform.rotation = modelpos.rotation; catmodel.transform.parent = modelpos; infoPanel.transform.Find("CatName").GetComponent <UILabel>().text = cat.Name; infoPanel.transform.Find("CatInfo").GetComponent <UILabel>().text = ( "lv:" + cat.Level + "\n" + "atk:" + cat.Atk + "\n" + "groupId:" + cat.GroupId ) ; }
public void OnSceneLoaded(Scene scene, LoadSceneMode mode) { Debug.Log(scene.name); if (scene.name == SceneConst.GameScene) { //打开游戏界面的时候,需要打开的界面需要注册 AppFacade.getInstance.SendNotification(NotiConst.INIT_MAIN_MENU_VIEW); AppFacade.getInstance.SendNotification(NotiConst.INIT_CUSTOMER_VIEW); AppFacade.getInstance.SendNotification(NotiConst.INIT_EMPLOYEE_VIEW); AppFacade.getInstance.SendNotification(NotiConst.INIT_CAT_GROUP_MENU_VIEW); AppFacade.getInstance.SendNotification(NotiConst.INIT_BUILDING_BLUEPRINT); AppFacade.getInstance.SendNotification(NotiConst.INITBUILDINGCHANGE);//注册模型改变 } if (scene.name == SceneConst.BattleScene) { AppFacade.getInstance.SendNotification(NotiConst.INITBATTLEVIEW); //注册战斗场景 BulitPool.GetInstance().DestructAll(); CatPool.GetInstance().DestructAll(); } }