// Update is called once per frame void Update() { if (prevState != state) { prevState = state; stateChange(); } if (state == TownState.HEALTHY) { text.text = "" + population; } else if (state == TownState.WARNING) { text.text = population + "\n " + currInfectionProb + "%"; } else if (state == TownState.INFECTED) { text.text = "" + population; } else if (state == TownState.OFFLINE) { text.text = ""; } }
IEnumerator infectTimer() { yield return(new WaitForSeconds(infectTime)); GameController.instance.gamestate.pendingTimers -= 1; state = TownState.INFECTED; }
public override void Close() { if (BasePanel != null) //다른패널에서 호출됬을경우 { TempCoroutine.instance.StopAllCoroutines(); base.Close(); string[] route = BasePanel.Split(' '); UIMgr.Open(route[0].ToString(), true); return; } //if (CurViewType == ViewType.Socket) //{ // if (DetailPopup != null && DetailPopup.gameObject.activeSelf) // { // DetailPopup.OnClose(); // return; // } //} //else if(CurViewType == ViewType.Evolve) //{ // if (BlockingObj.activeSelf) // return; //} if (IsChangeCostume) { TownState town = SceneManager.instance.GetState <TownState>(); town.MyHero.SetChangeSkin(true); } TempCoroutine.instance.StopAllCoroutines(); base.Close(); UIMgr.OpenTown(); }
public static void SetTownState(TownState townState) { for (int i = 0; i < GameState.townStates.Length; i++) { if (GameState.townStates[i].id == townState.id) { GameState.townStates[i] = townState; } } }
public override void OnEnter(System.Action callback) { base.OnEnter(callback); _townState = SceneManager.instance.CurrentStateBase() as TownState; //parent.PlayAnim(_townState != null ? eAnimName.Anim_idle : eAnimName.Anim_battle_idle, true, 0.1f ); prevPos = parent.cachedTransform.position; samePosCnt = 0; }
void neighborInfected(Town infectedNeighbor) { if (state == TownState.HEALTHY) { state = TownState.WARNING; } //infectedNum += 1; neighbors.Remove(infectedNeighbor); infectedNeighbors.Add(infectedNeighbor); }
void Awake() { Owner = GetComponent <Unit>(); OwnerTrans = Owner.transform; //defaultLayer = LayerMask.NameToLayer( "Default" ); //terrainLayer = LayerMask.NameToLayer( "Terrain" ); //terrainOutsideLayer = LayerMask.NameToLayer( "Terrain_Outside" ); _townState = SceneManager.instance.CurrentStateBase() as TownState; }
IEnumerator checkOffline() { yield return(new WaitForSeconds(0.2f)); while (neighbors.Count > 0) { //Debug.Log(neighbors.Count); yield return(new WaitForSeconds(0.1f)); } state = TownState.OFFLINE; yield return(null); }
public static void InitializeTowns(JSONObject data) { List <TownState> townStates = new List <TownState>(); foreach (JSONObject townJson in data["towns"].list) { TownState state = new TownState(); state.id = townJson["id"].str; state.townName = townJson["name"].str; townStates.Add(state); } GameState.townStates = townStates.ToArray(); }
public void Init() { TownState townstate = SceneManager.instance.CurrentStateBase() as TownState; if (townstate != null) { TownUnit = townstate.MyHero; } StartCoroutine(CreateTownNpcs()); CreatePotals(); StartCoroutine(CreateCreatures()); SetNewMyTownHero(TownUnit); }
public void FootEvent() { if (MyUnit == null) { return; } if (MyUnit.CurrentState != UnitState.Move) { return; } string effName = MyUnit.Animator.GetAnimationEffect(MyUnit.Animator.CurrentAnim); if (string.IsNullOrEmpty(effName)) { effName = "Fx_pc_moving_effect"; } if (!effName.Equals("0")) { if (TownState.TownActive) { uint soundID = MyUnit.Animator.GetAnimationSound(MyUnit.Animator.CurrentAnim); if (soundID != 0) { SoundManager.instance.PlaySfxUnitSound(soundID, MyUnit._audioSource, MyUnit.cachedTransform, true); } TownState.SpawnEffect(effName, MyUnit.cachedTransform.position, Quaternion.Euler(Vector3.zero)); } else { uint soundID = MyUnit.Animator.GetAnimationSound(MyUnit.Animator.CurrentAnim); if (soundID != 0) { SoundManager.instance.PlaySfxUnitSound(soundID, MyUnit._audioSource, MyUnit.cachedTransform); } G_GameInfo.SpawnEffect(effName, MyUnit.cachedTransform.position, Quaternion.Euler(Vector3.zero)); } } }
/// <summary> 마을 유저 초대 </summary> public void OnInviteTown() { TownState town = SceneManager.instance.GetState <TownState>(); if (town == null) { return; } if (GameMode == GAME_MODE.COLOSSEUM) { NetworkClient.instance.SendPMsgColosseumInviteC(1, null); } else { NetworkClient.instance.SendPMsgMultiBossInviteC(1, null); } }
public void setTownState(string s) { if (s.ToUpper() == "HEALTHY") { state = TownState.HEALTHY; } else if (s.ToUpper() == "WARNING") { state = TownState.WARNING; } else if (s.ToUpper() == "INFECTED") { state = TownState.INFECTED; } else if (s.ToUpper() == "OFFLINE") { state = TownState.OFFLINE; } }
public override void OnEnter(System.Action callback) { base.OnEnter(callback); TownState _townstate = SceneManager.instance.CurrentStateBase() as TownState; if (_townstate == null) { //마을아니다 parent.SetObstacleAvoidance(true); //명장 예외처리 //if (parent.CharInfo.GetBuffValue(BuffType.ANGLEDEFUP) > 0f) if (parent.BuffCtlr != null && (parent.BuffCtlr.GetTypeBuffCheck(BuffType.ANGLEDEFUP) || parent.BuffCtlr.GetTypeBuffCheck(BuffType.CHARGEATTACK))) { parent.PlayAnim(eAnimName.Anim_Extra, true, 0.1f, true); } else { parent.PlayAnim(eAnimName.Anim_battle_idle, true, 0.08f, true); } } else { //마을이다 if (parent is InteractionNPC) { if (Random.Range(0, 100) > 50) { parent.PlayAnim(eAnimName.Anim_idle, true, 0.1f); } else { parent.PlayAnim(eAnimName.Anim_intro, true, 0.1f); } } else { parent.PlayAnim(eAnimName.Anim_idle, true, 0.08f, true); } } }
public static TownState GetTownState(string townId) { if (!GameState.isInitialized) { GameState.InitializeState(); } foreach (TownState state in GameState.townStates) { if (state.id == townId) { return(state); } } //throw new System.Exception("Couldn't find TownState with townId " + townId); TownState output = new TownState(); output.id = townId; return(output); }
public override void OnEnter(System.Action callback) { base.OnEnter(callback); TownState _townstate = SceneManager.instance.CurrentStateBase() as TownState; if (_townstate == null) { parent.SetObstacleAvoidance(false); } if (parent.CharInfo.GetBuffValue(BuffType.ANGLEDEFUP) > 0f) { moveSpeedRatio = 0.6f; parent.PlayAnim(eAnimName.Anim_walk, true, 0.1f, true); } else { moveSpeedRatio = 1f; parent.PlayAnim(eAnimName.Anim_move, true, 0.1f, true); } }
new void Awake() { base.Awake(); itemCanvas_go.name = "townCanvas"; itemCanvas.sortingOrder = 2; itemCanvasRect.localPosition = new Vector3(0, -0.75f, 0); itemCanvasRect.sizeDelta = new Vector2(3f, 1f); itemtype = ItemType.TOWN; animator = GetComponent <Animator>(); prevState = TownState.HEALTHY; state = TownState.HEALTHY; neighbors = new List <Town>(); infectedNeighbors = new List <Town>(); //infectedNum = 0; currInfectionProb = (float)infectionProb; placeText(); }
IEnumerator infectExposure() { while (infectedNeighbors.Count > 0) { float infectInc = GameController.instance.gamestate.infectionPlusInc * (float)infectedNeighbors.Count; if (GameController.instance.gamestate.blksLeft.getBlocksLeft() == 0) { infectInc = 20; } currInfectionProb += infectInc; //Debug.Log(""+currInfectionProb); float diceRoll = Random.Range(0.0f, 1.0f); //Debug.Log(diceRoll+" "+(float)currInfectionProb / 100f); if (diceRoll <= currInfectionProb / 100f && GameController.instance.gamestate.level != 1) { state = TownState.INFECTED; yield return(null); } yield return(new WaitForSeconds(GameController.instance.gamestate.incTiming)); } state = TownState.HEALTHY; //got rid of infected neighbor(s) yield return(null); }
public void ChangeTownCanvas(int newCanvasState) { townState = (TownState)newCanvasState; UpdateTownCanvas(); }
/// <summary> 코스튬 장착 응답 </summary> public void OnPMsgCostume(NetData._CostumeData costume) { Transform modelTf = null; if (GameMode == GAME_MODE.COLOSSEUM || GameMode == GAME_MODE.MULTI_RAID) { //if (NetData.instance.GameRoomData.OwnerId == CharInven.GetCharUUID()) if (NetData.instance.GameRoomData.Owner == null)//내가 방장 { modelTf = PlayCharRoot; } else { int arr = NetData.instance.GetGameRoomUserArr(CharInven.GetCharUUID()); modelTf = PartnerModelRoot[arr]; } } else { modelTf = PlayCharRoot; } CharInven.EquipCostume(costume._costumeIndex); uint weaponId = 0, clothId = 0, headId = 0; if (CharInven.isHideCostum) { NetData._ItemData head = CharInven.GetEquipParts(ePartType.HELMET); NetData._ItemData cloth = CharInven.GetEquipParts(ePartType.CLOTH); NetData._ItemData weapon = CharInven.GetEquipParts(ePartType.WEAPON); if (head != null) { headId = head._equipitemDataIndex; } if (cloth != null) { clothId = cloth._equipitemDataIndex; } if (weapon != null) { weaponId = weapon._equipitemDataIndex; } } GameObject go = UIHelper.CreatePcUIModel("ReadyPopup", modelTf, CharInven.GetCharIdx(), headId, costume._costmeDataIndex, clothId, weaponId, CharInven.GetEquipSKillSet().SkillSetId, 5, CharInven.isHideCostum, false); go.GetComponent <UIModel>().CrossFadeAnimation(eAnimName.Anim_skill8, eAnimName.Anim_idle); Transform slotTf = CostumGrid.FindChild(string.Format("{0}", costume._costmeDataIndex)); slotTf.FindChild("mount").gameObject.SetActive(true); slotTf.FindChild("btn_insert").collider.enabled = false; UILabel nameLb = slotTf.FindChild("state_d3").GetComponent <UILabel>(); nameLb.text = _LowDataMgr.instance.GetStringCommon(37); //("장착중"); //기존꺼 수정하기 CostumMountIconTf.parent.FindChild("mount").gameObject.SetActive(false); CostumMountIconTf.parent.FindChild("btn_insert").collider.enabled = true; CostumMountIconTf.parent.FindChild("bg").GetComponent <UISprite>().color = new Color(1, 1, 1, 0.3f); UILabel lbl = CostumMountIconTf.parent.FindChild("state_d3").GetComponent <UILabel>(); lbl.text = _LowDataMgr.instance.GetStringCommon(38); //("장착하기"); CostumMountIconTf.parent = slotTf; CostumMountIconTf.localPosition = Vector3.zero; CostumMountIconTf.localScale = Vector3.one; slotTf.FindChild("bg").GetComponent <UISprite>().color = Color.white; TownState town = SceneManager.instance.GetState <TownState>(); town.MyHero.SetChangeSkin(true); }
public override void Init() { PosStr = _LowDataMgr.instance.GetStringCommon(1217); if (TownState.TownActive) { TownState town = SceneManager.instance.GetState <TownState>(); PlayerUnit = town.MyHero; IsInGame = false; Detail.mainTexture = Resources.Load("UI/MapTexture/TownMap") as Texture; Simple.mainTexture = Resources.Load("UI/MapTexture/TownMap") as Texture; for (int i = 0; i < 20; i++) { GameObject NpcGo = Instantiate(NpcRoot.GetChild(0).gameObject) as GameObject; NpcGo.transform.parent = NpcRoot; NpcGo.transform.localPosition = Vector3.zero; NpcGo.transform.localScale = Vector3.one; NpcGo.SetActive(false); GameObject NpcDetailGo = Instantiate(NpcDetailRoot.GetChild(0).gameObject) as GameObject; NpcDetailGo.transform.parent = NpcDetailRoot; NpcDetailGo.transform.localPosition = Vector3.zero; NpcDetailGo.transform.localScale = Vector3.one; NpcDetailGo.SetActive(false); } // Destroy(NpcRoot.GetChild(0).gameObject); // Destroy(NpcDetailRoot.GetChild(0).gameObject); MapName.text = _LowDataMgr.instance.GetStringCommon(532); Channel.text = string.Format(_LowDataMgr.instance.GetStringCommon(1200), 1);//추후에 채널 생기면 정상적인 값 넣어줘야함 } else { G_GameInfo.CharacterMgr.allrUUIDDic.TryGetValue(NetData.instance.GetUserInfo().GetCharUUID(), out PlayerUnit); IsInGame = true; Detail.mainTexture = Resources.Load("UI/MapTexture/FreeFightMap") as Texture; Simple.mainTexture = Resources.Load("UI/MapTexture/FreeFightMap") as Texture; MapName.text = _LowDataMgr.instance.GetStringCommon(12); Channel.text = string.Format(_LowDataMgr.instance.GetStringCommon(1200), 1);//추후에 채널 생기면 정상적인 값 넣어줘야함 } DetailPosTf.GetComponent <UISprite>().flip = IsInGame ? UIBasicSprite.Flip.Nothing : UIBasicSprite.Flip.Both; SimplePosTf.GetComponent <UISprite>().flip = IsInGame ? UIBasicSprite.Flip.Nothing : UIBasicSprite.Flip.Both; EventDelegate.Set(SimpleMap.GetComponent <UIEventTrigger>().onClick, delegate() { DetailMap.SetActive(true); SimpleMap.SetActive(false); SumSimpleMap.SetActive(false); UIBasePanel chatPopup = UIMgr.GetUIBasePanel("UIPopup/ChatPopup"); if (chatPopup != null) { chatPopup.gameObject.SetActive(false); } UIBasePanel townPanel = UIMgr.GetTownBasePanel(); if (townPanel != null) { townPanel.gameObject.SetActive(false); } UIBasePanel hudPanel = UIMgr.GetHUDBasePanel(); if (hudPanel != null) { hudPanel.gameObject.SetActive(false); } UIBasePanel joy = UIMgr.GetUIBasePanel("UIObject/Joystick"); if (joy != null) { (joy as Joystick).SetJoyActive(false); } }); // 맵안을클릭했을시 이동함수 EventDelegate.Set(Detail.transform.GetComponent <UIEventTrigger>().onClick, delegate() { for (int kk = 0; kk < DotRoot.childCount; kk++) { DotRoot.GetChild(kk).gameObject.SetActive(false); } // //ui상 좌표를 구함 // Vector3 touchPos = Vector3.zero; // if (0 < Input.touchCount) // { // Touch touch = Input.GetTouch(0); // touchPos = uiMgr.UICamera.camera.ScreenToWorldPoint(touch.position); // } // else // touchPos = uiMgr.UICamera.camera.ScreenToWorldPoint(Input.mousePosition); // DesGo.transform.position = touchPos; // int arr = IsInGame ? 1 : 0; // Vector3 pos = DesGo.transform.localPosition;//DetailPosTf.localPosition; // Vector2 mapPos = Detail.transform.localPosition; // Debug.Log(string.Format("MovePosss {0}, {1}", touchPos, Detail.transform.localPosition)); // pos.x = (pos.x + mapPos.x) - Offset[arr].x; // pos.z = (pos.y + mapPos.y) - Offset[arr].y; // pos.y = (pos.y + mapPos.y) - Offset[arr].y; // pos.x = (pos.x / Detail.localSize.x) * WorldScale[arr].x; // pos.z = (pos.z / Detail.localSize.y) * WorldScale[arr].y; // pos.y = (pos.y / Detail.localSize.y) * WorldScale[arr].y; //// 좌표값으로 이동 // if (PlayerUnit != null) // { // pos = -pos; // pos.y = PlayerUnit.transform.position.y; // NavMeshHit hit; // if (NavMesh.SamplePosition(pos, out hit, 10f, -1)) // { // pos.y = hit.position.y; // PlayerUnit.MovePosition(pos, 1f); // } // } }); DetailMap.SetActive(false); SimpleMap.SetActive(true); SumSimpleMap.SetActive(true); BossDetailPosTf.gameObject.SetActive(false); BossSimplePosTf.gameObject.SetActive(false); EventDelegate.Add(onShow, OnShow); NpcRoot.gameObject.SetActive(TownState.TownActive); NpcDetailRoot.gameObject.SetActive(TownState.TownActive); for (int i = 0; i < 20; i++) { Transform tf = Instantiate(SubGroup.GetChild(0)) as Transform; tf.parent = SubGroup; tf.localPosition = Vector3.zero; tf.localScale = Vector3.one; tf.gameObject.SetActive(false); } EventDelegate.Set(Grid.transform.FindChild("Slot_Func").GetComponent <UIButton>().onClick, delegate() { OnClickNpcList(0); }); EventDelegate.Set(Grid.transform.FindChild("Slot_Story").GetComponent <UIButton>().onClick, delegate() { OnClickNpcList(1); }); }