void OnTriggerEnter2D(Collider2D hit) { MatchManager matchManager = GameObject.FindObjectOfType <MatchManager>(); Guy hitGuy = hit.gameObject.GetComponent <Guy>(); string hitTag = hit.gameObject.tag; if (hitGuy != null && matchManager.players[matchManager.currentPlayer].playerName != hitGuy.owner) { if (hitTag == "Guy") { if (hitGuy.health > 0) { hitGuy.TakeDamage(GameManager.STATE.MacheteDamage); // Debug.Log("Damaged Guy."); // Debug.Log(matchManager.players[matchManager.currentPlayer].playerName); // Debug.Log(hitGuy.owner); } } else { // Debug.Log(hitTag); } } else { if (hitGuy == null) { // Debug.Log("Failed to hit non-guy."); } else { // Debug.Log("Failed to hit own team (self or other)."); } } }
private void Awake() { timer = comboCounter + 1; if (instance == null) { instance = this; } players = new Player[2]; for (int i = 0; i < playerUIs.Length; i++) { playerUIs[i].InitUI(); GameObject player = Instantiate(playerPrefab) as GameObject; Player playerComponent = player.GetComponent <Player>(); playerComponent.playerNum = i + 1; players[i] = playerComponent; if (i > 0) { SpriteRenderer sprite = playerComponent.visual.gameObject.GetComponent <SpriteRenderer>(); sprite.color = Color.red; } } for (int i = 0; i < players.Length; i++) { players[i].InitPlayer(); } cam.updating = true; for (int i = 0; i < Input.GetJoystickNames().Length; i++) { Debug.Log(Input.GetJoystickNames()[i]); } }
public void Batting(MatchManager matchManager, PlayerController controller) { //Debug.Log(homerun); //Debug.Log(modifiedHomerun); if (Random.value < controller.modifiedDiscipline) { ManageRunner(matchManager, controller, 1); //Debug.Log(this.transform.name+": BB"); controller.stats.ChangeBB(1); } else { if (Random.value < controller.modifiedAverage) { if (Random.value < controller.modifiedHomerun) { ManageRunner(matchManager, controller, 4); //Debug.Log(this.transform.name+": HR"); controller.stats.ChangeHR(1); } else { ManageRunner(matchManager, controller, 1); //Debug.Log(this.transform.name+": single"); } controller.stats.ChangeH(1); } else { matchManager.outs++; //Debug.Log(this.transform.name+": out"); } } controller.stats.ChangePA(1); }
public void TotalSets5CountTest() { var manager = new MatchManager("Player1", "Player3", 5); manager.PlayMatch(); Assert.IsTrue(manager.Match.Sets.Count <= 5); }
protected override void Awake() { base.Awake(); manager = MatchManager.instance; posButton.onClick.AddListener(EndAction); negButton.onClick.AddListener(EndAction); }
public void ButtonPress() { if (Button.ms_active) { Profile.StopHighlightingParts(m_player, MatchProfile.ms_currentMatch); //if not match play tearing bubble wrap sound if (this.m_player.CheckForMatch(MatchProfile.ms_currentMatch)) { //Profile.HighLightMatchingParts(m_player, MatchProfile.ms_currentMatch); PlayerProfile.RemoveMatch(); this.m_audioSource.PlayOneShot(m_matchDislikeClip); MatchManager.SaveMatch(MatchProfile.ms_currentMatch.gameObject); //this.m_player.DropNoMatchCorrections(MatchProfile.ms_currentMatch); MatchManager.ShowWhyYouFailed(true); } else { //Profile.HighLightConflicts(m_player, MatchProfile.ms_currentMatch); //else if it wasn't a match play popping noise this.m_audioSource.PlayOneShot(m_noMatchDislikeClip); MatchManager.SaveReject(MatchProfile.ms_currentMatch.gameObject); MatchManager.InstantiateNewMatch(false); } } }
private void LeaveState() { // use this function to neatly close down a state. switch (m_State) { case GameState.Menu: { m_MenuManager = null; break; } case GameState.Match: { m_MatchManager = null; foreach (AgentManager a in Get_Players()) { a.Hide_Name(); } break; } default: { // THROW ERROR! throw new System.NotImplementedException("State missing in GameManager.Leave_State()"); } } }
public override IEnumerator Enter() { if (OnPlayerTurn != null) { OnPlayerTurn(); } if (touchHandler == null) { touchHandler = new TouchHandler(); } MatchManager.startTimer = true; MatchManager.SetCamera(); if (MatchManager.AreAllBallsInHole()) { MatchManager.Instance.NextHole(); return(base.Enter()); } if (MatchManager.GetCurrentPlayer().AreAllBallsInHole()) { MatchManager.ChangePlayer(); MatchManager.SetState(new PlayerTurn(MatchManager)); } return(base.Enter()); }
private void TriggerStartServer() { LogMessage("Starting server..."); ButtonStart.Enabled = false; Task.Run(() => StartServer()); //key = ConfigurationManager.AppSettings["ThreadCount"]; //if (!string.IsNullOrEmpty(key)) // threadCount = Convert.ToInt32(key); //WriteToConsole("ThreadCount: " + threadCount); var key = ConfigurationManager.AppSettings["BioMatcher.CacheSize"]; if (!string.IsNullOrEmpty(key)) { CacheSize = Convert.ToInt32(key); } key = ConfigurationManager.AppSettings["BioMatcher.BenchmarkMode"]; if (!string.IsNullOrEmpty(key)) { BenchmarkMode = DataHelper.GetBool(key); // Convert.ToInt32(key); } LogMessage("BenchmarkMode: " + BenchmarkMode); MatchManager.Mode = MatcherModes.ServerFullCache; MatchManager.StartupPath = Application.StartupPath; MatchManager.BenchmarkMode = BenchmarkMode; MatchManager.CacheSize = CacheSize; var cacheStatus = MatchManager.Initialize(); LogMessage(cacheStatus); LogMessage("CacheSize: " + (BenchmarkMode ? CacheSize : MatchManager.Cache.TotalFingerprints)); }
public PooledObject AddHealthBar(Building building, Vector3 offset, string prefabName = null) { if (NGObjectPool.Instance == null) { return(null); } string pName = string.IsNullOrEmpty(prefabName) ? this.HealthBarBuildingPrefabName : prefabName; PooledObject hBar = NGObjectPool.Instance.GetFromPool(PooledObjectType.INGAMEUI, pName); HealthBar bar = hBar.pHealthBar; bar.target = building.transform; bar.targetHealth = building; bar.targetOffset = offset; bar.SetColor(MatchManager.GetTeamColor(building.team)); Transform t = bar.cachedTransform; t.SetParent(this.indicatorPanel.transform, false); t.ResetLocal(); bar.HideBar(); return(hBar); }
void Start() { GameMode = new NormalGameMode(); MatchManager = new MatchManager(GameMode); Init(); }
public GameObject m_SymbolPool; //the starting point of for the symobl set by the roulette controller again void Awake() { if (match == null) { match = MatchManager.instance; } }
/// <summary> /// Prepare the closing of this view model. /// </summary> /// <returns>The actions to execute before closing</returns> private IEnumerable <IResult> PrepareClose() { if (MatchManager.MatchModified) { var question = new YesNoCloseQuestionResult() { Title = "Save the Changes?", Question = "The Player Informations are modified. Save changes?", AllowCancel = true, }; yield return(question); var match = MatchManager.Match; var lastRally = match.Rallies.LastOrDefault(); //TODO if (match.Rallies.Any()) { if (lastRally.Winner == MatchPlayer.None) { match.Rallies.Remove(lastRally); } } if (question.Result) { foreach (var action in MatchManager.SaveMatch()) { yield return(action); } } } }
public void DoubleStartTest() { var matchManager = new MatchManager(); matchManager.StartMatch("Spain", "Italy"); matchManager.StartMatch("Spain", "Italy"); }
protected override async void OnDeactivate(bool close) { if (MatchManager.MatchModified) { var mySettings = new MetroDialogSettings() { AffirmativeButtonText = "Save and Close", NegativeButtonText = "Cancel", FirstAuxiliaryButtonText = "Close Without Saving", AnimateShow = true, AnimateHide = false }; var result = await DialogCoordinator.ShowMessageAsync(this, "Close Window?", "You didn't save your changes?", MessageDialogStyle.AffirmativeAndNegativeAndSingleAuxiliary, mySettings); bool _shutdown = result == MessageDialogResult.Affirmative; if (_shutdown) { Coroutine.BeginExecute(MatchManager.SaveMatch().GetEnumerator(), new CoroutineExecutionContext() { View = this.GetView() }); Application.Current.Shutdown(); } } events.Unsubscribe(this); }
public void SuccessfulFlowTest() { var matchManager = new MatchManager(); var match = matchManager.StartMatch("Spain", "United Kingdom"); match = matchManager.UpdateScore(match, 1, null); match = matchManager.UpdateScore(match, null, 1); match = matchManager.UpdateScore(match, null, 2); var summaryStringList = matchManager.GetSummary().Select(x => x.ToString()); var summary = string.Join("\n", summaryStringList); var expectedSummary = "Uruguay 6 - Italy 6\nSpain 10 - Brazil 2\nMexico 0 - Canada 5\nArgentina 3 - Australia 1\nGermany 2 - France 2\nSpain 1 - United Kingdom 2"; Assert.AreEqual(summary, expectedSummary); matchManager.FinishMatch(match); summaryStringList = matchManager.GetSummary().Select(x => x.ToString()); summary = string.Join("\n", summaryStringList); expectedSummary = "Uruguay 6 - Italy 6\nSpain 10 - Brazil 2\nMexico 0 - Canada 5\nArgentina 3 - Australia 1\nGermany 2 - France 2"; Assert.AreEqual(summary, expectedSummary); }
private void Start() { CurrentMatch = this; var cardManager = new CardManager(); cardManager.LoadFromFile("Cards"); var player = CreatePlayer("Player", cardManager); var foe = CreatePlayer("Foe", cardManager); _currentStep = 0; _currentSide = 0; _steps = new List <Step> { new UntapStep(), new DrawStep(), new SomeStep(), }; _sides = new List <MatchSide> { new MatchSide(player, player.Decks[0], 20), new MatchSide(foe, foe.Decks[0], 20), }; PlayerSideManager.MatchSide = _sides[0]; FoeSideManager.MatchSide = _sides[1]; StartCoroutine(StartGame()); }
public void Start() { _matchManager = FindObjectOfType <MatchManager>(); _economyManager = FindObjectOfType <EconomyManager>(); TurnManager.onTurnReset += GenerateMoney; }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.layer >= 9 && collision.gameObject.layer <= 12) { MatchManager.getInstance().scene2End(collision.gameObject.layer); } }
public void Start() { // obtain reference to match manager script to access game state GameObject managerObject = GameObject.Find("MatchManager"); m = managerObject.GetComponent <MatchManager>(); // loading save weights /* * string fileName = "weights.txt"; * string destPath = Path.Combine("", fileName); * string lastLine = File.ReadAllLines(destPath).Last(); * string[] savedWeights = lastLine.Split(' '); * weights.Add("bias", float.Parse(savedWeights[0])); * weights.Add("closest_food", float.Parse(savedWeights[1])); * weights.Add("closest_pup", float.Parse(savedWeights[2])); * weights.Add("avoid_enemy", float.Parse(savedWeights[3])); * weights.Add("go_to_enemy", float.Parse(savedWeights[4])); */ // use trained weights weights.Add("bias", 0f); weights.Add("closest_food", -.762f); weights.Add("closest_pup", -.583f); weights.Add("avoid_enemy", -1.578f); weights.Add("go_to_enemy", 6.254f); }
public JoinRoomIncomingMessage(ChatRoomManager chatRoomManager, MatchListingManager matchListingManager, MatchManager matchManager) { this.chatRoomManager = chatRoomManager; this.matchListingManager = matchListingManager; this.matchManager = matchManager; }
private void Awake() { if (Instance == null) { Instance = this; } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } gameInterface = GameObject.Find("GameManager").GetComponent <MatchMaking>().inGamePanel; uiReferences = gameInterface.GetComponent <UIReferences>(); endTurnButton = uiReferences.endTurnButton; turnNumberText = uiReferences.turnNumberText.GetComponent <Text>(); playerActivText = uiReferences.playerActivText.GetComponent <Text>(); if (PhotonNetwork.PlayerList.Length <= 1) { debugMode = true; } else { debugMode = false; } }
internal MatchListing(MatchListingManager matchListingManager, MatchManager matchManager, MatchListingType type, ClientSession creator, LevelData levelData, string name, uint minRank, uint maxRank, uint maxMembers, bool onlyFriends) { this.matchListingManager = matchListingManager; this.matchManager = matchManager; this._Clients = new ClientSessionCollectionLimited((int)maxMembers, this.Leave0); this.LobbyClients = new ClientSessionCollection(); this.BannedClients = new ConcurrentBag <IUserIdentifier>(); this.LevelData = levelData; this.Name = name; this.MinRank = minRank; this.MaxRank = maxRank; this.MaxMembers = maxMembers; this.OnlyFriends = onlyFriends; this.Type = type; if (creator != null) { this._HostSocketId = creator.SocketId; creator.Connection.OnDisconnected += this.OnCreatorDisconnectEarly; } }
protected void Application_Start(object sender, EventArgs e) { int cacheSize = 0; bool benchmarkMode = false; var key = ConfigurationManager.AppSettings["BioMatcher.CacheSize"]; if (!string.IsNullOrEmpty(key)) { cacheSize = Convert.ToInt32(key); } key = ConfigurationManager.AppSettings["BioMatcher.BenchmarkMode"]; if (!string.IsNullOrEmpty(key)) { benchmarkMode = DataHelper.GetBool(key); // Convert.ToInt32(key); } //LogMessage("BenchmarkMode: " + BenchmarkMode); MatchManager.Mode = MatcherModes.ServerFullCache; MatchManager.StartupPath = Server.MapPath("~"); MatchManager.BenchmarkMode = benchmarkMode; MatchManager.CacheSize = cacheSize; var cacheStatus = MatchManager.Initialize(); //LogMessage(cacheStatus); //LogMessage("CacheSize: " + (BenchmarkMode ? CacheSize : FingerprintMatcher.Cache.TotalFingerprints)); }
public ManageController() { db = new RankContext(); sessionManager = new SessionManager(); accountManager = new AccountManager(db, sessionManager); matchManager = new MatchManager(db); }
internal UnityMatchManager() { matchManager = new MatchManager(); unityEntityManager2D = new UnityEntityManager(this, RepresentationMode.Mode2D); unityEntityManager3D = new UnityEntityManager(this, RepresentationMode.Mode3D); unityCameraManager2D = new UnityCameraManager(RepresentationMode.Mode2D); unityCameraManager3D = new UnityCameraManager(RepresentationMode.Mode3D); userInterfaceManager = new UserInterfaceManager(GameObject.Find("Canvas")); var hudActivity = new HudActivity(this, userInterfaceManager.canvasObject.transform.Find("HUD").gameObject); userInterfaceManager.RegisterActivity(hudActivity); userInterfaceManager.ShowActivity(hudActivity.name); UpdateRepresentationMode(); foreach (var poolItem in ExamplePoolConfig.Pools) { matchManager.entityManager.InitPool(poolItem.name, poolItem.count); unityEntityManager2D.InitPool(poolItem.name, poolItem.count); unityEntityManager3D.InitPool(poolItem.name, poolItem.count); } }
private void button1_Click(object sender, EventArgs e) { var random = new Random().Next(0, seeds.Count - 1); var result = MatchManager.Identify(new MatchRequest(seeds[random])); //MatchManager.Cache.RandomSample)); txtStatus.Text += "\r\n\r\n" + result.Extra; }
private void cmdInitialize_Click(object sender, EventArgs e) { //var threadCount = 2; cacheSize = Convert.ToInt32(txtCount.Text); txtStatus.Text += "\r\nCacheSize: " + cacheSize; txtStatus.Text += "\r\nBenchmarkMode: " + benchmarkMode; MatchManager.StartupPath = Application.StartupPath; MatchManager.BenchmarkMode = benchmarkMode; MatchManager.CacheSize = cacheSize; MatchManager.SaveTempalates = chkSave.Checked; var result = MatchManager.Initialize(); txtStatus.Text += "\r\n" + result; txtStatus.Text += "\r\nMatch Index: " + MatchManager.Cache.RandomSampleIndex; if (!benchmarkMode) { txtStatus.Text += "\r\nActual Cache: " + MatchManager.Cache.TotalFingerprints; } txtStatus.Text += "\r\n**Matcher Initialized Successfull**"; cmdBenchmarkTask.Enabled = true; cmdBenchmarkSeed.Enabled = true; MatchManager.BenchmarkMode = true; }
public void Setup() { _mockMatchConfiguration = new Mock <IMatchConfiguration>(); _mockRulesManager = new Mock <IRulesManager>(); _mockOpponantManager = new Mock <IOpponentManager>(); _matchManager = new MatchManager(_mockMatchConfiguration.Object, _mockRulesManager.Object, _mockOpponantManager.Object); }
public void Boot(MatchManager matchManager) { gameObject.SetActive (true); this.match = matchManager; animator = gameObject.GetComponent<ActiveAnimator> (); animator.EnableAllAnimations (); currentFrame = animator.StartAnimationOrNext (AnimationID.IDLE); controls = GetComponent<CharacterController> (); }
// Use this for initialization void Start () { matchManager = GameObject.FindWithTag("MatchManager").GetComponent<MatchManager>(); label = GetComponent<UILabel>(); numPlayers = NetworkManager.GetPlayerList().Count; playerRankings = new List<int>(); for (int i = 0; i < numPlayers; ++i) { playerRankings.Add(i); } }
private void Awake() { matchmanager = FindObjectOfType<MatchManager>(); if (matchmanager == null) Debug.LogError("MatchManager not found"); matchmanager.RegisterBall(this); // start pos (set by first ball) if (start_pos == null) start_pos = transform.position; else transform.position = (Vector2)start_pos; // other camshake = Camera.main.GetComponent<CameraShake>(); ball_audio = GetComponentInChildren<BallAudio>(); }
public override void Start() { base.Start(); currentHealth = maxHealth; matchManager = GameObject.FindGameObjectWithTag("MatchManager").GetComponent<MatchManager>(); damageOverlayImage = GameObject.FindGameObjectWithTag("DamageOverlay").GetComponent<UI2DSprite>(); matchData = spaceship.GetComponent<SpaceshipMatchData>(); if (damageOverlayImage == null) { Debug.Log("No UI2DSprite tagged with 'DamageOverlay' was found in the scene!"); } Color indicatorColor = enemyIndicator.renderer.material.GetColor("_TintColor"); indicatorColor.a = 0.0f; enemyIndicator.renderer.material.SetColor("_Tint", indicatorColor); /* Make local copy of material so multiple of the same ships don't reference the same one. */ Material electricFieldCopy = Instantiate(electricField) as Material; electricField = electricFieldCopy; spaceshipShell.renderer.material = electricFieldCopy; spaceshipShell.GetComponent<ScrollUVLinear>().materialToScroll = electricFieldCopy; }
public void Awake() { match_manager = Object.FindObjectOfType<MatchManager>(); if (match_manager == null) Debug.LogError("GameManager missing."); }
void Start() { Vehicle = gameObject.GetComponent<VehicleController>() as VehicleController; ShootingBehaviour = gameObject.GetComponentInChildren<ShootingBehaviour>() as ShootingBehaviour; TankTurret = gameObject.GetComponentInChildren<TankTurretBehaviour>() as TankTurretBehaviour; Manager = Object.FindObjectOfType(typeof(MatchManager)) as MatchManager; }
public void setManager(MatchManager matchManager) { this.matchManager = matchManager; }
public void Initialize(Mage mage, Mage opponent, MatchManager manager) { this.mage = mage; this.opponent = opponent; //this.match = match; }
public void Inititalize(int number, MatchManager manager) { // player info player_num = number; player_name = GameSettings.Instance.player_name[number - 1]; player_color = GameSettings.Instance.GetPlayerColor(number); // player_state hearts = GameSettings.Instance.GetNumHearts(); crystals = GameSettings.Instance.GetNumCrystals(); // Player controller if (GameSettings.Instance.IsAIControlled(number)) { gameObject.AddComponent<AIPlayerController>(); GetComponent<AIPlayerController>().Initialize(this, opponent, manager); } else { gameObject.AddComponent<HumanPlayerController>(); GetComponent<HumanPlayerController>().Initialize( GameSettings.Instance.GetHumanControlScheme(number)); } this.pc = GetComponent<PlayerController>(); // input events pc.InputCast += OnCastSpell; pc.InputSpellCodeA += OnSpellCodeA; pc.InputSpellCodeB += OnSpellCodeB; pc.InputSpellCodeX += OnSpellCodeX; pc.InputSpellCodeY += OnSpellCodeY; // other references rb = GetComponent<Rigidbody2D>(); hover = GetComponent<Hover>(); // sprites SetGraphicsNormal(); spriterenderer_highlights.color = player_color; // spells spellmanager = FindObjectOfType<SpellManager>(); if (spellmanager == null) Debug.LogError("SpellManager not found"); mana_slots = new List<ManaSlot>(GameSettings.Instance.GetNumSlots()); for (int i = 0; i < GameSettings.Instance.GetNumSlots(); ++i) mana_slots.Add(new ManaSlot()); }
void Start() { Manager = Object.FindObjectOfType(typeof(MatchManager)) as MatchManager; }