/* * // Update is called once per frame * void Update() * { * * foreach (UITouchInner touch in iPhoneInputMgr.MockTouches()) * { * if (m_UIManager != null) * { * if (m_UIManager.HandleInput(touch)) * { * continue; * } * } * } * } */ public override void Show() { base.Show(); cashPanel.SetCash(GameApp.GetInstance().GetGameState().GetCash()); cashPanel.Show(); }
// Member Types // Member Functions // Public: // Private: void Start() { CSpellData.TSpellData tData = GameApp.GetInstance().GetSpellDataComponent().GetSpellData(CSpell.EType.TETHER); CSpell oSpell = GameApp.GetInstance().GetWarlock().GetComponent <CSpellbook>().GetSpell(CSpell.EType.TETHER); m_fTimer = 0.0f; m_fTimerTime = 0.1f; m_fDamage = oSpell.GetDamageAmount(); m_fPushBack = oSpell.GetPushbackAmount(); m_fVelocity = 13.0f; m_bExplode = false; m_bHooked = false; m_fRange = oSpell.GetRange(); m_fDuration = 0.0f; m_fMaxDuration = 6.2f; m_fMaxSize = 2.0f; m_fRadius = oSpell.GetRadius(); m_fTimer = 0.1f; m_fDistanceTraveled = 0.0f; }
public LoadingPanel() { m_LoadingText = new UIText(); m_LoadingText.Set(ConstData.FONT_NAME1, "LOADING...", ColorName.fontColor_darkorange); m_LoadingText.AlignStyle = UIText.enAlignStyle.center; m_LoadingText.Rect = AutoRect.AutoPos(new Rect(0, 70, 960, 100)); m_desc = new UIText(); m_desc.Set(ConstData.FONT_NAME2, "YOUR TOWN HAS BEEN INFECTED...\n\nALL YOUR FAMILY, FRIENDS, AND CO-WORKERS HAVE TURNED INTO ZOMBIES.\n\nFIGHT FOR YOUR LIFE.\n\nFIGHT FOR AS LONG AS YOU CAN...", Color.white); m_desc.AlignStyle = UIText.enAlignStyle.center; m_desc.Rect = AutoRect.AutoPos(new Rect(0, 120, 960, 640)); string path = Application.dataPath + "/../../Documents/"; this.Add(m_desc); if (GameApp.GetInstance().GetGameState().FirstTimeGame&& Application.loadedLevelName != SceneName.ARENA_MENU) { } else { this.Add(m_LoadingText); int size = AvatarInfo.TIPS_INO.Length; int rnd = Random.RandomRange(0, size); m_desc.Rect = AutoRect.AutoPos(new Rect(0, 0, 960, 640)); m_desc.SetText(AvatarInfo.TIPS_INO[rnd]); } }
// Private: protected override void ProcessCastInput() { if (m_bSelected && Input.GetMouseButtonDown(0)) { Vector3 m_vCastPosition = GameApp.GetInstance().GetCursor().Get3DPosition(); Ray rayInfo = Camera.main.ScreenPointToRay(m_vCastPosition); if (rayInfo.direction.y < 0) { Vector3 hitPos = rayInfo.origin + (rayInfo.direction * ((-rayInfo.origin.y) / rayInfo.direction.y)); Vector3 vTempMyPos = transform.GetComponent <CWarlockMotor>().transform.position; Vector3 vDistance = vTempMyPos - hitPos; float _fDistance = vDistance.magnitude; if (_fDistance < 0.0f) { _fDistance *= -1.0f; } if (_fDistance <= m_fRange) { BeginCast(); } } } }
public static void PlayAudio(AudioSource audio) { if (GameApp.GetInstance().GetGameState().MusicOn) { audio.Play(); } }
public void RunStartGamePan(float _fHeight, float _fInitialDelay, float _fAreanPanDuration, float _fArenaPanDistanceOffset, float _fWarlockPanDuration) { m_oWarlock = GameApp.GetInstance().GetWarlock(); m_fPanArenaDistanceOffset = _fArenaPanDistanceOffset; m_fPanArenaDelayDuration = _fInitialDelay; m_fPanArenaDelayTimer = 0.0f; m_fPanArenaDuration = _fAreanPanDuration; m_fPanArenaTimer = 0.0f; m_fPanWarlockDuration = _fWarlockPanDuration; m_fPanWarlockTimer = 0.0f; m_bPanning = true; m_vPanWarlockTargetPosition = m_oWarlock.transform.position + m_vWarlockPositionOffset; m_vPanInitialPosition = new Vector3(0.0f, _fHeight, -_fArenaPanDistanceOffset); gameObject.GetComponent <CCursor>().SetSideScrollingEnabled(false); }
public void GetPurchaseStatus() { if (iapProcessing != IAPName.None) { int statusCode = IAP.purchaseStatus(null); iapLockPanel.UpdateSpinner(); if (statusCode == 0) { } else if (statusCode == 1) { Debug.Log("statusCode:" + statusCode); GameApp.GetInstance().GetGameState().DeliverIAPItem(iapProcessing); cashPanel.SetCash(GameApp.GetInstance().GetGameState().GetCash()); iapLockPanel.Hide(); iapProcessing = IAPName.None; } else { Debug.Log("statusCode:" + statusCode); iapLockPanel.Hide(); iapProcessing = IAPName.None; } } }
void ProcessButtons() { // Button: Join if (m_oJoinButton.DoUpdate()) { if (m_sChosenServer != "") { JoinGame(m_sChosenServer, m_strPlayerName); } } // Button: Host if (m_oHostButton.DoUpdate()) { if (m_strPlayerName == "") { SetName(""); // Gives a default name } GameApp.GetInstance().CreateGame(m_strPlayerName, m_strPlayerName); } // Button: Quit if (m_oQuitButton.DoUpdate()) { // TODO: Open a window to confirm exit. Application.Quit(); } }
public override void Show() { currentSelectionWeaponIndex = 0; weaponScroller.Clear(); weaponScroller.SetImageSpacing(AutoRect.AutoSize(WeaponsLogoTexturePosition.WeaponLogoSpacing)); for (int i = 0; i < weaponList.Count; i++) { if (weaponList[i].Exist == WeaponExistState.Owned) { UIImage uiImage = new UIImage(); TexturePosInfo info = WeaponsLogoTexturePosition.GetWeaponTextureRect(i); uiImage.SetTexture(info.m_Material, info.m_TexRect); weaponScroller.Add(uiImage); } } weaponScroller.EnableScroll(); Material shopMaterial = UIResourceMgr.GetInstance().GetMaterial("ShopUI"); weaponScroller.AddOverlay(shopMaterial, new Rect(720, 610, 160, 75)); Material avatarLogoMaterial = UIResourceMgr.GetInstance().GetMaterial("Avatar"); weaponScroller.SetMaskImage(avatarLogoMaterial, AvatarTexturePosition.Mask); weaponScroller.Show(); base.Show(); avatarFrame.ChangeAvatar(GameApp.GetInstance().GetGameState().Avatar); avatarFrame.Show(); cashPanel.SetCash(gameState.GetCash()); UpdateWeaponInfo(); weaponInfoPanel.Show(); }
public void Yes() { reviewDialog.Hide(); GameApp.GetInstance().GetGameState().AddScore(1000); GameApp.GetInstance().Save(); Application.OpenURL("http://www.trinitigame.com/callofminizombies/review/"); }
public void WarlockHealth_ApplyDamage(float _fAmount, bool _bTellOthers) { if (m_bTakeDamage && GameApp.GetInstance().GetSceneArena().GetState() == CSceneArena.EState.FIGHTING) { if (_bTellOthers) { networkView.RPC("WarlockHealth_ApplyDamage", RPCMode.OthersBuffered, _fAmount, false); } m_fCurrentHealth -= _fAmount; if (m_bAlive && m_fCurrentHealth < 0) { WarlockHealth_Kill(false); // Don't send to others because this will be called on all clients machines } else { m_bUpdateHealthTexture = true; } } }
void SelectWeapon(int weaponID, int selectRectIndex) { bool alreadySelected = false; for (int j = 0; j < SELECTION_NUM; j++) { if (rectToWeaponMap[j] != -1) { if (rectToWeaponMap[j] == weaponID) { alreadySelected = true; } } } if (!alreadySelected) { int oldWeaponID = rectToWeaponMap[selectRectIndex]; if (oldWeaponID != -1) { weaponList[oldWeaponID].IsSelectedForBattle = false; } weaponList[weaponID].IsSelectedForBattle = true; Material weaponIconMaterial = UIResourceMgr.GetInstance().GetMaterial("Weapons3"); Rect rect = WeaponsLogoTexturePosition.GetWeaponIconTextureRect(weaponID); battleWeaponGrid.SetGridTexture(selectRectIndex, weaponIconMaterial, rect); battleWeaponGrid.SetGridTexturePosition(selectRectIndex, selectRectIndex); rectToWeaponMap[selectRectIndex] = weaponID; avatarFrame.ChangeAvatar(GameApp.GetInstance().GetGameState().Avatar); } }
// Update is called once per frame void Update() { //transform.Translate(speed * Time.deltaTime, Space.World); //proTransform.Translate(flySpeed * dir * deltaTime, Space.World); if (Time.time - startTime > explodeTime) { ResourceConfigScript rc = GameApp.GetInstance().GetResourceConfig(); Player player = GameApp.GetInstance().GetGameScene().GetPlayer(); float distance = Mathf.Sqrt((transform.position - player.GetTransform().position).sqrMagnitude); if (distance < radius) { Ray ray = new Ray(transform.position, player.GetTransform().position - (transform.position)); RaycastHit rayhit; if (Physics.Raycast(ray, out rayhit, distance, 1 << PhysicsLayer.WALL | 1 << PhysicsLayer.TRANSPARENT_WALL | 1 << PhysicsLayer.PLAYER)) { Debug.Log(rayhit.collider.gameObject.name); if (rayhit.collider.gameObject.name == "Player") { player.OnHit(damage); } } else { player.OnHit(damage); } } GameObject.Instantiate(rc.rocketExlposion, transform.position, Quaternion.identity); GameObject.Destroy(gameObject); } }
void ProcessNameField() { // Check if the Name input field has been selected if (Input.GetMouseButtonUp(0)) { if (m_rectNameField.Contains(GameApp.GetInstance().GetCursor().GetScreenPosition())) { m_bNameBoxSelected = true; } else { m_bNameBoxSelected = false; SetName(m_strPlayerName); } } // Update the Name input field with player input if (m_bNameBoxSelected) { if (m_strPlayerName.Length < 15) { foreach (char c in Input.inputString) { if (c != "\b"[0]) { m_strPlayerName += Input.inputString; SetName(m_strPlayerName); } } } } }
void Awake() { //! 实例化 ResourceConfig if (GameObject.Find("ResourceConfig") == null) { GameObject resourceConfig = Object.Instantiate(Resources.Load("ResourceConfig")) as GameObject; resourceConfig.name = "ResourceConfig"; DontDestroyOnLoad(resourceConfig); } //! 添加Music 对象 管理音乐播放 if (GameObject.Find("Music") == null) { GameApp.GetInstance().Init(); GameObject musicObj = new GameObject("Music"); DontDestroyOnLoad(musicObj); musicObj.transform.position = new Vector3(0, 1, -10); AudioSource audioSource = musicObj.AddComponent <AudioSource>(); audioSource.clip = GameApp.GetInstance().GetResourceConfig().menuAudio; musicObj.AddComponent <MenuMusicScript>(); audioSource.loop = true; audioSource.bypassEffects = true; audioSource.rolloffMode = AudioRolloffMode.Linear; audioSource.Play(); } }
public override void Show() { //GameApp.GetInstance().GetGameScene().BonusWeapon = GameApp.GetInstance().GetGameState().GetWeapons()[2]; SetUnlockWeapon(GameApp.GetInstance().GetGameScene().BonusWeapon); firstLineText.Set(ConstData.FONT_NAME2, GameApp.GetInstance().GetGameScene().BonusWeapon.Name + " IS AVAILABLE FOR PURCHASE!", ColorName.fontColor_darkorange); base.Show(); }
// Member Types // Member Functions // Public: // Protected: override protected void Initialise(ref string _rsDescription, ref EType _reSpellType, ref float _rfCooldownLength, ref float _rfDamageLevelIncrement, ref float _rfPushbackLevelIncrement, ref float _rfRange, ref uint _ruiCurrancyUpgradeCost, ref float _rfCastDelay) { CSpellData.TSpellData tData = GameApp.GetInstance().GetSpellDataComponent().GetSpellData(CSpell.EType.SWAP); _rsDescription = tData.sDescription; _reSpellType = tData.eType; _rfCooldownLength = tData.fCooldown; _rfDamageLevelIncrement = tData.fDamageLevelInrement; _rfPushbackLevelIncrement = tData.fPushbackLevelIncrement; _rfRange = tData.fRange; _ruiCurrancyUpgradeCost = tData.uiUpgradeCost; _rfCastDelay = tData.fCastDelay; m_fRadius = tData.fRadius; m_fCooldownLength = tData.fCooldown; m_fCooldownTimerLevelIncrement = tData.fCooldownLevelIncrement; m_fCastDelay = tData.fCastDelay; m_fCastDelayLevelIncrement = tData.fCastDelayLevelIncrement; m_fDamageAmount = tData.fDamage; m_fDamageLevelIncrement = tData.fDamageLevelInrement; m_fPushbackAmount = tData.fPushback; m_fPushbackLevelIncrement = tData.fPushbackLevelIncrement; m_fRange = tData.fRange; m_fRangeLevelIncrement = tData.fRangeLevelIncrement; m_fRadius = tData.fRadius; m_fRadiusLevelIncrement = tData.fRadiusLevelIncrement; }
// Use this for initialization IEnumerator Start() { yield return(0); triggerTransform = gameObject.transform; triggered = false; foreach (EnemySpawnScript es in spawns) { if (es != null) { es.TriggerBelongsto = this; } } hasSecondarySpawns = false; foreach (EnemySpawnScript es in secondarySpawns) { if (es != null) { es.TriggerBelongsto = this; hasSecondarySpawns = true; } } alreadyMaxSpawned = false; GameApp.GetInstance().GetGameScene().AddTrigger(this); gameScene = GameApp.GetInstance().GetGameScene(); }
private void NetworkStatusChangeEvent(ConnectionID socket, NetworkManager.Status wError) { if (wError != NetworkManager.Status.Connected) { GameApp.GameMgr.DestoryGame(true); if (bShowSocketTips == false) { return; } if (socket == ConnectionID.Lobby) { HallTransfer.Instance.cnCloseWebpage(); GameApp.PopupMgr.Confirm("提示", "为了您的账户安全,请重新登录!", delegate(MessageBoxResult style) { GameApp.GetInstance().SwitchAccount(); }, 15); } else { HallTransfer.Instance.cnCloseWebpage(); GameApp.PopupMgr.Confirm("提示", wError == NetworkManager.Status.TimeOut ? "连接超时,请重试!" : "与游戏服务器断开连接,请重试!", delegate(MessageBoxResult style) { GameApp.GetInstance().SwitchAccount(); }, 15); } } }
// Use this for initialization void Start() { loadingPanel = new LoadingPanel(); loadingPanel.Show(); startTime = Time.time; m_UIManager = gameObject.AddComponent <UIManager>() as UIManager; m_UIManager.SetParameter(8, 1, false); //m_UIManager.SetUIHandler(this); m_UIManager.CLEAR = true; Transform audioFolderTrans = transform.Find("Audio"); audioPlayer.AddAudio(audioFolderTrans, "Button"); audioPlayer.AddAudio(audioFolderTrans, "Battle"); GameApp.GetInstance().GetGameState().Achievement.SubmitAllToGameCenter(); if (!GameApp.GetInstance().GetGameState().FromShopMenu) { m_UIManager.Add(loadingPanel); } StartCoroutine("Init"); }
void ResetDirection() { /* * if (Input.deviceOrientation == DeviceOrientation.Portrait) * { * iPhoneSettings.screenOrientation = iPhoneScreenOrientation.Portrait; * } */ #if UNITY_IPHONE if (GameApp.GetInstance().PreviousOrientation != Input.deviceOrientation) { FlurryTAd.RotateTad(); GameApp.GetInstance().PreviousOrientation = Input.deviceOrientation; if (Input.deviceOrientation == DeviceOrientation.LandscapeRight) { iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeRight; } else if (Input.deviceOrientation == DeviceOrientation.LandscapeLeft) { iPhoneSettings.screenOrientation = iPhoneScreenOrientation.LandscapeLeft; } } #endif /* * if (Input.deviceOrientation == DeviceOrientation.PortraitUpsideDown) * { * iPhoneSettings.screenOrientation = iPhoneScreenOrientation.PortraitUpsideDown; * } */ }
public void OnSendSocketCloseNotify(int wSubCmdID) { GameApp.PopupMgr.Confirm("提示", "账号在别处登录,请检查账户安全性!", delegate(MessageBoxResult style) { GameApp.GetInstance().SwitchAccount(); }, 5.0f); }
// Use this for initialization IEnumerator Start() { yield return(0); selfTrans = transform; cameraTrans = GameApp.GetInstance().GetGameScene().GetCamera().transform; init = true; }
public void InitialiseAwards() { m_bFirstBloodTaken = false; m_cPlayerList = GameApp.GetInstance().GetPlayerList(); m_iStartingPlayers = m_cPlayerList.Count(); m_iPlayersDead = 0; }
public void UpdateAnimation() { GameObject avatarObj = GetModel(); Weapon w = GameApp.GetInstance().GetGameState().GetBattleWeapons()[0]; string wNameEnd = Weapon.GetWeaponNameEnd(w.GetWeaponType()); if (avatarObj != null) { if (w.GetWeaponType() == WeaponType.RocketLauncher || w.GetWeaponType() == WeaponType.Sniper) { if (Time.time - lastMotionTime > 7.0f) { string aniName = ""; if (avatarObj.GetComponent <UnityEngine.Animation>().IsPlaying(AnimationName.PLAYER_RUN + wNameEnd)) { aniName = AnimationName.PLAYER_IDLE + wNameEnd; } else { aniName = AnimationName.PLAYER_RUN + wNameEnd; } avatarObj.GetComponent <UnityEngine.Animation>()[aniName].wrapMode = WrapMode.Loop; avatarObj.GetComponent <UnityEngine.Animation>().CrossFade(aniName); lastMotionTime = Time.time; } } else if (w.GetWeaponType() == WeaponType.Saw) { if (Time.time - lastMotionTime > 7.0f) { avatarObj.GetComponent <UnityEngine.Animation>()[AnimationName.PLAYER_SHOT + "_Saw2"].wrapMode = WrapMode.ClampForever; avatarObj.GetComponent <UnityEngine.Animation>().CrossFade(AnimationName.PLAYER_SHOT + "_Saw"); avatarObj.GetComponent <UnityEngine.Animation>().CrossFadeQueued(AnimationName.PLAYER_SHOT + "_Saw2"); lastMotionTime = Time.time; } if (avatarObj.GetComponent <UnityEngine.Animation>().IsPlaying(AnimationName.PLAYER_SHOT + "_Saw2") && (Time.time - lastMotionTime > avatarObj.GetComponent <UnityEngine.Animation>()[AnimationName.PLAYER_SHOT + "_Saw2"].clip.length * 2)) { avatarObj.GetComponent <UnityEngine.Animation>().CrossFade(AnimationName.PLAYER_IDLE + wNameEnd); } } else { if (Time.time - lastMotionTime > 7.0f) { avatarObj.GetComponent <UnityEngine.Animation>()[AnimationName.PLAYER_STANDBY].wrapMode = WrapMode.ClampForever; avatarObj.GetComponent <UnityEngine.Animation>().CrossFade(AnimationName.PLAYER_STANDBY); lastMotionTime = Time.time; } if (avatarObj.GetComponent <UnityEngine.Animation>()[AnimationName.PLAYER_STANDBY].time > avatarObj.GetComponent <UnityEngine.Animation>()[AnimationName.PLAYER_STANDBY].clip.length) { avatarObj.GetComponent <UnityEngine.Animation>().CrossFade(AnimationName.PLAYER_IDLE + wNameEnd); } } } }
public void UpdateTutorialStep(float deltaTime, Player player) { //guis.SetTutorialText("ALRIGHT, NOW THAT YOU'VE GOT DOWN THE BASICS, TRY SHOOTING THE ZOMBIE IN FRONT OF YOU."); if (GameApp.GetInstance().GetGameScene().GetEnemies().Count == 0) { ts.GoToNextStep(); } }
public override void Show() { base.Show(); avatar3DFrame.ChangeAvatar(GameApp.GetInstance().GetGameState().Avatar); //avatarPanel.SetText(ConstData.FONT_NAME1, AvatarInfo.AVATAR_NAME[(int)GameApp.GetInstance().GetGameState().Avatar], ColorName.fontColor_darkred); cashPanel.SetCash(GameApp.GetInstance().GetGameState().GetCash()); cashPanel.Show(); avatar3DFrame.Show(); }
void OnTriggerEnter(Collider c) { if (c.GetComponent <Collider>().gameObject.layer == PhysicsLayer.PLAYER) { Player player = GameApp.GetInstance().GetGameScene().GetPlayer(); player.OnPickUp(itemType); Destroy(gameObject); } }
public override void Update() { if (fadeTimer.Ready()) { string strSceneName = ""; if (fadeTimer.Name == "0") { if (false && GameApp.GetInstance().GetGameState().FirstTimeGame) { //! Application.LoadLevel(SceneName.SCENE_TUTORIAL); strSceneName = SceneName.SCENE_TUTORIAL; } else { //! Application.LoadLevel(SceneName.SCENE_ARENA); strSceneName = SceneName.SCENE_ARENA; } } else if (fadeTimer.Name == "1") { //! Application.LoadLevel(SceneName.SCENE_HOSPITAL); strSceneName = SceneName.SCENE_HOSPITAL; } else if (fadeTimer.Name == "2") { //! Application.LoadLevel(SceneName.SCENE_PARKING); strSceneName = SceneName.SCENE_PARKING; } else if (fadeTimer.Name == "3") { //! Application.LoadLevel(SceneName.SCENE_VILLAGE); strSceneName = SceneName.SCENE_VILLAGE; } else if (fadeTimer.Name == "shop") { //! Application.LoadLevel(SceneName.ARENA_MENU); strSceneName = SceneName.ARENA_MENU; } else if (fadeTimer.Name == "return") { //! Application.LoadLevel(SceneName.START_MENU); strSceneName = SceneName.START_MENU; } SceneManager.LoadScene(strSceneName); fadeTimer.Do(); } }
/* * IEnumerator GameLoop() * { * * while (true) * { * //game loop time control * deltaTime = Time.time - lastUpdateTime; * lastUpdateTime = Time.time; * * //execute game loop every frame * GameApp.GetInstance().Loop(deltaTime); * * //sleep 20 miliseconds * yield return new WaitForSeconds(0.02f); * * } * }*/ // Use this for initialization void Start() { Debug.Log("start"); GameApp.GetInstance().Init(); GameApp.GetInstance().CreateScene(); lastUpdateTime = Time.time; //StartCoroutine(GameLoop()); }