public virtual void tick(float deltaTime) { if (!PhotonNetwork.IsConnected || photonView.IsMine) { float travelDuration = Mathf.Max(minTravelDuration, m_travelDuration + m_additionalDuration); float delta = deltaTime / travelDuration; // Travel along our path, destroy ourselves once we reach the goal m_progress += delta; if (updatePositionAlongPath(m_progress)) { // Damage the player PlayerController.localPlayer.applyDamage(m_damage); AnalyticsHelpers.reportMonsterReachedGoal(this); // We destroy ourselves after tick has concluded MonsterManager.destroyMonster(this, false); } } else { // Mimics how PhotonTransformView works m_progress = Mathf.MoveTowards(m_progress, m_networkProgress, m_progressDelta * (1.0f / PhotonNetwork.SerializationRate)); updatePositionAlongPath(m_progress); } }
public static TowerBase spawnTower(string prefabId, int playerId, Vector3Int tileIndex, Vector3 spawnPos) { object[] spawnData = new object[2]; spawnData[0] = playerId; spawnData[1] = tileIndex; GameObject towerObj = PhotonNetwork.Instantiate(prefabId, spawnPos, Quaternion.identity, 0, spawnData); if (!towerObj) { return(null); } TowerBase tower = towerObj.GetComponent <TowerBase>(); Assert.IsNotNull(tower); PlayerController controller = PlayerController.getController(playerId); if (controller) { controller.onTowerBuilt(tower); } // This only gets called once per server AnalyticsHelpers.reportTowerPlaced(tower, tileIndex); return(tower); }
// This is the main entry point of the application. static void Main(string[] args) { AnalyticsHelpers.Start(AnalyticsConstants.MOBILE_CENTER_iOS_API_KEY); // if you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. UIApplication.Main(args, null, "AppDelegate"); }
// This is the main entry point of the application. static void Main(string[] args) { AnalyticsHelpers.Start(AnalyticsConstants.MobileCenteriOSApiKey); // if you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. UIApplication.Main(args, null, "AppDelegate"); }
// This is the main entry point of the application. static void Main(string[] args) { // if you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. MobileCenter.Configure("baed21b7-dfb1-4af5-90ef-1d4af7793678"); AnalyticsHelpers.Start(); UIApplication.Main(args, null, "AppDelegate"); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { // Override point for customization after application launch. // If not required for your application you can safely delete this method AnalyticsHelpers.Start(AnalyticsConstants.MobileCenteriOSAPIKey); #if DEBUG Xamarin.Calabash.Start(); #endif return(true); }
// TODO: Document (returns true if killed) public bool takeDamage(int amount, Object instigator = null) { if (m_health <= 0 || !m_canBeDamaged) { return(false); } if (PhotonNetwork.IsConnected && !photonView.IsMine) { return(false); } if (amount <= 0) { Debug.LogError("Cannot apply less than zero damage to a monster"); return(false); } m_health = Mathf.Max(m_health - amount, 0); reaction.Ouch(); bool bKilled = m_health <= 0; // Execute events before potentially destroying ourselves if (OnMonsterTakenDamage != null) { OnMonsterTakenDamage.Invoke(amount, bKilled); } // Nothing more needs to be done if still alive if (m_health > 0) { healthBar.SetHealth(m_health); return(false); } AnalyticsHelpers.reportMonsterDeath(this, instigator ? instigator.name : "unknown"); // We can give gold to the local player, since we already // checked that this monster belongs to them PlayerController.localPlayer.giveGold(m_reward); if (!string.IsNullOrEmpty(m_deathScriptPrefab)) { object[] spawnData = new object[1]; spawnData[0] = GameManager.manager.getPlayerIdFromBoard(m_board); PhotonNetwork.Instantiate(m_deathScriptPrefab, transform.position, Quaternion.identity, 0, spawnData); } MonsterManager.destroyMonster(this); return(true); }
public bool IsOperatingSystemSupported(int majorVersion, int minorVersion) { try { double sdkInt; double.TryParse(Build.VERSION.Release, out sdkInt); return(sdkInt >= (majorVersion + minorVersion * .1)); } catch (Exception e) { AnalyticsHelpers.Log("Operating System Check Failed", e.Message, e); return(false); } }
public async Task <string> GetSavedUsername() { string username = null; try { username = await BlobCache.UserAccount.GetObject <string>("username"); } catch (Exception e) { AnalyticsHelpers.Log("Username Not Found", e.Message, e); } return(username); }
async partial void YouTubeLinkButton_TouchUpInside(UIButton sender) { AnalyticsHelpers.TrackEvent(AnalyticsConstants.YouTubeButtonTapped); var canOpenYouTubeApp = UIApplication.SharedApplication.CanOpenUrl(GetAppUrl(AppType.YouTube)); if (canOpenYouTubeApp) { OpenLinkInApp(AppType.YouTube); } else { await OpenLinkInSFSafariViewController(GetWebUrl(AppType.YouTube)); } }
public async Task <bool> CheckLogin(string username, string password) { string _username = null; string _password = null; try { _username = await BlobCache.UserAccount.GetObject <string>("username"); } catch (Exception e) { AnalyticsHelpers.Log("No Username Stored", e.Message, e); return(false); } try { _password = await BlobCache.UserAccount.GetObject <string>("password"); } catch (Exception e) { AnalyticsHelpers.Log("No Password Store", e.Message, e); return(false); } try { IEnumerable <string> test = await BlobCache.UserAccount.GetAllKeys(); } catch (Exception e) { AnalyticsHelpers.Log("Error Getting User Account Keys", e.Message, e); } if (_username == null || _password == null) { return(false); } if (password == _password && username == _username.ToString()) { return(true); } return(false); }
public void takeDamage(int amount, Object instigator) { if (PhotonNetwork.IsConnected && !photonView.IsMine) { return; } if (amount <= 0) { Debug.LogError("Cannot apply less than zero damage to a tower"); return; } if (PhotonNetwork.IsConnected) { photonView.RPC("TakeDamageRPC", RpcTarget.All, amount); } else { TakeDamageRPC(amount); } healthBar.SetHealth(m_health); //Update Healthbar UI if (m_health <= 0) { AnalyticsHelpers.reportTowerDestroyed(this, instigator ? instigator.name : "Unknown"); if (CameraEffectsController.instance) { CameraEffectsController.instance.CameraShake(destroyedShakeIntensity, destroyedShakeDuration, destroyedShakeRotation); } destroyTower(this); } }
/// <summary> /// Handles a selection input based on current board player is viewing. /// This should only be called on the owning clients player controller /// </summary> /// <param name="screenPos">Screen position of selection</param> /// <param name="rightClick">If selection was made using right click</param> private void handleSelection(Vector3 screenPos, bool rightClick) { // Right click is being used to activate abilities while in editor, // in actual games (where we are connected), we want to ignore this if (PhotonNetwork.IsConnected && rightClick) { return; } // Convert from screen space to world space Vector3 worldPos = m_camera.ScreenToWorldPoint(screenPos); BoardManager viewedBoard = getViewedBoardManager(); if (!viewedBoard) { return; } if (viewedBoard == Board && !rightClick) { if (!m_canPlaceTowers) { return; } Vector3Int tileIndex = viewedBoard.positionToIndex(worldPos); if (!viewedBoard.isPlaceableTile(tileIndex)) { return; } TowerBase tower = viewedBoard.getTowerOnTile(tileIndex); if (tower) { // Try destroying the tower if player has bulldozing active if (m_canBulldoze) { // Refund half of a cost of the tower giveGold(tower.m_cost / 2); AnalyticsHelpers.reportTowerBulldozed(tower); TowerBase.destroyTower(tower, true); } } else if (m_canBuildInBulldozeMode || !m_canBulldoze) { // We call this as selectedPos is highly likely not to be // the center of the tile, while this 100% will be Vector3 spawnPos = viewedBoard.indexToPosition(tileIndex); // Spawn tower on the server (replicates back to us if not master client) string prefabName; TowerBase towerPrefab = m_towersList.getSelectedTower(out prefabName); if (towerPrefab && canAfford(towerPrefab.m_cost)) { placeTowerAt(towerPrefab, prefabName, tileIndex, spawnPos); } } } else { // Right click is for using abilities while in editor if (!PhotonNetwork.IsConnected && !rightClick) { return; } AbilityBase ability = m_towersList.getSelectedAbility(); if (!canUseAbility(ability)) { return; } // Make sure we have actually clicked on the board Vector3Int tileIndex = viewedBoard.positionToIndex(worldPos); if (!viewedBoard.isValidTile(tileIndex)) { return; } // Check if this ability would allow us to select this position if (!ability.canUseAbilityHere(this, viewedBoard, worldPos, tileIndex)) { return; } ability.activateAbility(this, viewedBoard, worldPos, tileIndex); } }
public override void OnCreate() { base.OnCreate(); AnalyticsHelpers.Start(AnalyticsConstants.MobileCenterDroidApiKey); }
public Profile GetProfile() { return(AnalyticsHelpers.GetProfile()); }
} // How long to delay another special monster spawn // MonsterBase Interface public override void initMoster(BoardManager boardManager, int pathToFollow) { base.initMoster(boardManager, pathToFollow); AnalyticsHelpers.reportSpecialMonsterSpawned(this); }