// Use this for initialization void Start() { startPos = transform.position; extendTo = new Vector3(0f,extendAmount,0f); yExtend = transform.position - extendTo; player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player1>(); }
// Use this for initialization void Start () { if(player == true){ gameObject.AddComponent<Player1>(); player_1 = gameObject.GetComponent<Player1>(); }else if(player == false){ gameObject.AddComponent<Player2>(); player_2 = gameObject.GetComponent<Player2>(); } }
void OnTriggerEnter2D(Collider2D other) { //if the collider collides with the player if(other.CompareTag("Player")) { //make the player equal the player player = other.gameObject.GetComponent<Player1>(); //send the player in the opposite direction they collide with knockbackDirection = other.GetComponent<Collider2D>().transform.position - transform.position; } }
void Awake () { if (player == null) { DontDestroyOnLoad (gameObject); player = this; } else if (player != this) { Destroy (gameObject); } }
// Actives the power up on the player given (true = player 1, false = player 2) public void ActivatePowerup(bool player){ Debug.Log("SPACE WALK ACTIVATED"); p1_movement = GameObject.Find("Player1").GetComponent<Player1>(); p2_movement = GameObject.Find("Player2").GetComponent<Player2>(); if(player == true){ p1_movement.jumpHeight += 5; }else{ p2_movement.jumpHeight += 5; } }
// Update is called once per frame void Update () { // TODO: Eventually remove this input check, this is for development use only if(Input.GetKeyUp(KeyCode.Escape)){ RespawnBall(); } if(player_1 == null){ player1 = GameObject.Find ("Player1"); player_1 = player1.GetComponent<Player1> (); } if(player_2 == null){ player2 = GameObject.Find ("Player2"); player_2 = player2.GetComponent<Player2> (); } }
// Use this for initialization void Start () { // Find and assign all relevent vars player1 = GameObject.Find ("Player1"); player2 = GameObject.Find ("Player2"); racket_p1 = GameObject.Find ("racket_p1"); racket_p2 = GameObject.Find ("racket_p2"); ball = GameObject.Find ("Ball").transform; ballMovement = ball.GetComponent<BallMovement> (); PauseGame (); player1_spawn = GameObject.Find ("player1_spawn").transform.position; player2_spawn = GameObject.Find ("player2_spawn").transform.position; player_1 = player1.GetComponent<Player1> (); player_2 = player2.GetComponent<Player2> (); stinger_source = gameObject.GetComponentInChildren<AudioSource>(); }
// Update is called once per frame void Update () { if(player_1 == null){ player_1 = GameObject.Find("Player1").GetComponent<Player1>(); } if(player_2 == null){ player_2 = GameObject.Find("Player2").GetComponent<Player2>(); } if(anim1 == null){ // Load player 1's character (default = Dennis) if(savedSelections.selected_p1 == "S. Racks"){ anim1 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/SRacks", typeof(RuntimeAnimatorController))); }else if(savedSelections.selected_p1 == "SH1-V4"){ anim1 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/SH1V4", typeof(RuntimeAnimatorController))); }else if(savedSelections.selected_p1 == "Colonel Topspin"){ anim1 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/ColonelTopspin", typeof(RuntimeAnimatorController))); }else{ anim1 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/Dennis", typeof(RuntimeAnimatorController))); } }else{ // Set the animator controller player_1._animator.runtimeAnimatorController = anim1; } if(anim2 == null){ // Load player 2's character (default = S. Racks) if(savedSelections.selected_p2 == "Dennis"){ anim2 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/Dennis", typeof(RuntimeAnimatorController))); }else if(savedSelections.selected_p2 == "SH1-V4"){ anim2 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/SH1V4", typeof(RuntimeAnimatorController))); }else if(savedSelections.selected_p2 == "Colonel Topspin"){ anim2 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/ColonelTopspin", typeof(RuntimeAnimatorController))); }else{ anim2 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/SRacks", typeof(RuntimeAnimatorController))); } }else{ // Set the animator controller player_2._animator.runtimeAnimatorController = anim2; } }
//Overrides the toString() in the player class. private void ShowPlayerDetails() { Console.WriteLine(Player1.ToString()); }
void Start() { player = gameObject.GetComponentInParent<Player1> (); player.canJump = false; }
// A world can be advanced without the players being advanced too. If this is the case // then projectile collision boundaries are enlarged automatically to account for // lack of knowledge about where players are virtual public void Advance(List <WorldAction> actions, bool advancePlayers, bool spawnPowerups) { // Advance players if (advancePlayers) { Player1.Advance(actions); Player2.Advance(actions); } // Advance spawn timer and spawn powerups if (spawnPowerups) { spawnTimer -= 1; if (spawnTimer <= 0 && powerups.Count < 64) { Powerup.SpawnRandom(this); spawnTimer = spawnTimerMax; } } // Advance powerups foreach (Powerup powerup in powerups) { powerup.Advance(null); } // Advance projectiles int len = projectiles.Count; for (int i = len - 1; i >= 0; i--) { Projectile projectile = projectiles[i]; if (projectile.Type == WeaponType.Minions) { // Destroy if marked for deletion with a HACK if (projectile.Type == WeaponType.None) { destroyProjectile(projectile); // Collide with all other projectiles (that are minions) } else if (i != 0) { for (int j = i - 1; j >= 0; j--) { Projectile other = projectiles[j]; bool didCollide = projectile.CollideWith(other); if (didCollide) { // Destroy both parties involved destroyProjectile(projectile); other.Type = WeaponType.None; // Mark other for deletion } } } } // In an AI situation, enlarge players bool enlarge = advancePlayers == false; projectile.Advance(null, enlarge); } postUpdate(); }
void Start() { p1Script = GameObject.Find("Player1").GetComponent <Player1>(); StartCoroutine(CheckIndex()); }
public ObservableMatch(Match match, TournamentContext context) { source = match; OwningContext = context; //Round doesn't change, initialize RoundFixed var totalPlayerCount = context.Tournament.ParticipantsCount; var lowerBoundExponent = Math.Floor(Math.Log(totalPlayerCount, 2)); var lowerBound = Math.Pow(2, lowerBoundExponent); if (match.Round < 0 && totalPlayerCount > lowerBound && totalPlayerCount <= lowerBound + (lowerBound / 2)) { Round = match.Round - 1; } else { Round = match.Round; } //Check if station assignment data checks out. If not, clear the assignment var player1Station = Player1 != null ? Player1.StationAssignment : default(string); var player2Station = Player2 != null ? Player2.StationAssignment : default(string); //If stations don't match, clear. Don't check completed matches because those will frequently have mismatching stations if (State != "complete" && player1Station != player2Station) { ClearStationAssignment(); } //Listen for when properties changed to that changed events for the convenience properties can also be fired. this.PropertyChanged += (sender, e) => { switch (e.PropertyName) { case "Player1Id": this.Raise("Player1", PropertyChanged); this.Raise("PlayerCount", PropertyChanged); if (Player1 != null) { Player1.IsMissing = false; //When a player gets added to a match, clear their missing flag } break; case "Player2Id": this.Raise("Player2", PropertyChanged); this.Raise("PlayerCount", PropertyChanged); if (Player2 != null) { Player2.IsMissing = false; //When a player gets added to a match, clear their missing flag } break; case "Player1PrereqMatchId": this.Raise("Player1PreviousMatch", PropertyChanged); break; case "Player2PrereqMatchId": this.Raise("Player2PreviousMatch", PropertyChanged); break; case "StartedAt": this.Raise("TimeSinceAvailable", PropertyChanged); break; case "State": //Clear station assignments if match state changes if (Player1 != null) { Player1.ClearStationAssignment(); } if (Player2 != null) { Player2.ClearStationAssignment(); } //If match state has changed to open, execute selected new match option if (State == "open") { var option = GlobalSettings.Instance.SelectedNewMatchAction; switch (option) { case NewMatchAction.AutoAssign: //TODO: Consider using lock block here to prevent potential multithreaded assignment to the same station var highestPriorityStation = Stations.Instance.GetBestNormalStation(); if (highestPriorityStation != null) { AssignPlayersToStation(highestPriorityStation.Name); } break; case NewMatchAction.Anywhere: AssignPlayersToStation("Any"); break; } } break; } }; var propertyChangedObs = Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(h => this.PropertyChanged += h, h => this.PropertyChanged -= h); //The following will create an observable sequence that will raise an event either when player1 changes or when player1's station assignment status changes var player1ChangedOrAssignmentChanged = propertyChangedObs.Where(a => a.EventArgs.PropertyName == "Player1") .Select(_ => { if (Player1 != null) { return(Observable.FromEventPattern <PropertyChangedEventHandler, PropertyChangedEventArgs>(h => { player1Queue.Enqueue(Player1); Player1.PropertyChanged += h; }, h => { player1Queue.Dequeue().PropertyChanged -= h; }) .Where(a => a.EventArgs.PropertyName == "IsAssignedToStation" || a.EventArgs.PropertyName == "StationAssignment") .Select(_2 => EventArgs.Empty).StartWith(EventArgs.Empty)); } else { return(Observable.Return(EventArgs.Empty)); } }).Switch(); //Subscribe to above observable sequence to maintain the assignment state of the match player1ChangedOrAssignmentChanged.Subscribe(_ => { IsMatchInProgress = Player1 != null && Player1.IsAssignedToStation; StationAssignment = Player1 == null ? null : Player1.StationAssignment; }); //Forcibly raise player1 property notification to assign station status this.Raise("Player1", PropertyChanged); }
// Use this for initialization void Start() { gameManager = GameObject.Find("GameManager").GetComponent<GameManager>(); GameObject rightUser = GameObject.Find("rightUser").gameObject; GameObject leftUser = GameObject.Find("leftUser").gameObject; is_right_user = true; if(is_right_user) { rightUser.AddComponent<Player1>(); leftUser.AddComponent<Player2>(); player1 = rightUser.GetComponent<Player1>(); player2 = leftUser.GetComponent<Player2>(); player1.is_right_user = true; player2.is_right_user = false; player = rightUser; } else { rightUser.AddComponent<Player2>(); leftUser.AddComponent<Player1>(); player1 = leftUser.GetComponent<Player1>(); player2 = rightUser.GetComponent<Player2>(); player1.is_right_user = false; player2.is_right_user = true; player = leftUser; } gameManager.SettingPlayers(); touchFrame = new TouchFrame(); bt_left = GameObject.Find("leftButton"); bt_right = GameObject.Find("rightButton"); joystick_bar = GameObject.Find("Joystick"); joystick_bg = GameObject.Find("Joystick_background"); bt_spike = GameObject.Find("Joystick_spikeButton"); sprite_bt_left = GameObject.Find("leftButton").GetComponent<tk2dSprite>(); sprite_bt_right = GameObject.Find("rightButton").GetComponent<tk2dSprite>(); touchEffect = GameObject.Find("TouchMotionEffect").GetComponent<TouchMotionEffect>(); if(controller != TouchControllerType.BUTTON) { GameObject.DestroyObject(bt_left as Object); GameObject.DestroyObject(bt_right as Object); } if(controller != TouchControllerType.JOYPAD) { GameObject.DestroyObject(bt_spike as Object); GameObject.DestroyObject(joystick_bg as Object); GameObject.DestroyObject(joystick_bar as Object); } cam = GameObject.Find("VollyBallCamera").GetComponent<tk2dCamera>(); SetJoyPadPos(); }
/// <summary> /// 炸弹效果的生成和方向判断 /// </summary> public void InitData(int weiLi) { j = weiLi; Invoke("Explode", 3f); player = GameObject.FindObjectOfType <Player1> (); }
public static void KillPlayer(Player1 player) { Destroy(player.gameObject); //on instancie là où se trouve le collider vide gm.RespawnPlayer(); }
// Use this for initialization void Start() { sockets = new Sockets(); client = new Client(); opPosY = 128; ballPosX = 0; ballPosY = 0; buffer = new byte[6]; gameStart = false; player1Score = 0; player2Score = 0; gui = GameObject.Find("GUI").GetComponent<GUIScript>(); p1 = (Player1) GameObject.Find ("Player1").GetComponent ("Player1"); p2 = (Player2) GameObject.Find ("Player2").GetComponent ("Player2"); bscript = (BallScript) GameObject.Find ("GameBall").GetComponent("BallScript"); lPaddle = GameObject.Find ("Goal2"); bWall = GameObject.Find ("BottomWall"); paddleRatio = (250.0f / (GameObject.Find("Goal1").transform.position.x - GameObject.Find("Goal2").transform.position.x)); wallRatio = (250.0f / (GameObject.Find ("TopWall").transform.position.y - bWall.transform.position.y)); }
// Reset ALL THE THINGS! void ResetRound(){ PauseGame (); RespawnPlayers (); RespawnBall (); player_1 = player1.GetComponent<Player1> (); player_2 = player2.GetComponent<Player2> (); player_1.SendMessage ("ResetRound"); player_2.SendMessage ("ResetRound"); ballMovement.numHits = 0; // Reset the number of volleys stinger_source.Play(); // Play the end of round stinger }
public void SettingPlayers() { P1 = FindObjectOfType(typeof(Player1)) as Player1; P2 = FindObjectOfType(typeof(Player2)) as Player2; }
public void Play() { //Here's where we include the Player1 choice of the match. Console.WriteLine($"{Player1.Name}'s turn."); Roshambo p1throw = Player1.GetRoshambo(); Console.WriteLine("======================================="); //Here's where the opponent plays, and their result is posted. Console.WriteLine($"{Player2.Name}'s turn."); Roshambo p2throw = Player2.GetRoshambo(); Console.WriteLine(". . . ."); Console.WriteLine("======================================="); Console.WriteLine($"{Player1.Name} : {p1throw}"); Console.WriteLine($"{Player2.Name} : {p2throw}"); //Now we validate who won the match. Rock beats Scissors, Scissors beats Paper, Paper beats Rock. //Both of the results being the same is a draw. if (p1throw == p2throw) { //Displays the message Console.WriteLine("That match was a draw."); //Adjusts the score ++drawScore; } else if (p1throw == Roshambo.rock && p2throw == Roshambo.scissors) { Console.WriteLine($"{Player1.Name} wins!"); ++winScore; } else if (p1throw == Roshambo.rock && p2throw == Roshambo.paper) { Console.WriteLine($"{Player2.Name} wins!"); ++loseScore; } else if (p1throw == Roshambo.paper && p2throw == Roshambo.rock) { Console.WriteLine($"{Player1.Name} wins!"); ++winScore; } else if (p1throw == Roshambo.paper && p2throw == Roshambo.scissors) { Console.WriteLine($"{Player2.Name} wins!"); ++loseScore; } else if (p1throw == Roshambo.scissors && p2throw == Roshambo.paper) { Console.WriteLine($"{Player1.Name} wins!"); ++winScore; } else if (p1throw == Roshambo.scissors && p2throw == Roshambo.rock) { Console.WriteLine($"{Player2.Name} wins!"); ++loseScore; } //We then go to a continue loop. while (true) { Console.WriteLine("Would you like to play agian (Y/N)"); string yn = Console.ReadLine().ToLower().Trim(); if (yn == "y") { Console.Clear(); Console.WriteLine($"======================================= \n{Player1.Name} vs {Player2.Name}\n======================================="); Console.WriteLine($"The Score is :: Wins: {winScore} Losses: {loseScore} Draws: {drawScore}"); Console.WriteLine("======================================="); Play(); } else if (yn == "n") { Console.WriteLine("Thank you for playing. (Press \"enter\" to exit)\n"); Console.ReadLine(); Environment.Exit(0); //A fancy way to exit the application once the response is made. break; } else { Console.WriteLine("Sorry, I didn't quite get that."); } } }
void Start() { turn = -1; socks = new Sockets(); takingTurn = false; moveCommands = 1; pawnObjects = new GameObject[4]; playerPositions = new int[4]; gui = GameObject.Find("Gui").GetComponent<Gui>(); p1 = GameObject.Find("Player1").GetComponent<Player1>(); p2 = GameObject.Find("Player2").GetComponent<Player2>(); p3 = GameObject.Find("Player3").GetComponent<Player3>(); p4 = GameObject.Find("Player4").GetComponent<Player4>(); winningMove = 0; pawnObjects[0] = GameObject.Find("Green1").GetComponent<Green1>().gameObject; pawnObjects[1] = GameObject.Find("Red1").GetComponent<Red1>().gameObject; pawnObjects[2] = GameObject.Find("Blue1").GetComponent<Blue1>().gameObject; pawnObjects[3] = GameObject.Find("Yellow1").GetComponent<Yellow1>().gameObject; }
// Use this for initialization void Start() { //destroy the bullet after the destroyTime seconds Destroy(gameObject, destroyTime); player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player1>(); }
void Start() { player = gameObject.GetComponentInParent <Player1> (); }
// Use this for initialization void Start() { coinAmount = resetCoinAmount; player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player1>(); }
static void Main(string[] args) { /*Ficha10Solucao.Exercicio1();*/ /*Ficha10Solucao.Exercicio2();*/ /*Ficha10Solucao.Exercicio3();*/ /*Ficha10Solucao.Exercicio4();*/ /*Ficha10Solucao.Exercicio5();*/ /*Ficha10Solucao.Exercicio7();*/ /*Ficha10Solucao.Exercicio8();*/ /*Ficha10Solucao.Exercicio10();*/ //Ficha10Solucao.Exercicio11(); //Ficha10Solucao.Exercicio12(); //Ficha10Solucao.Exercicio13(); //Ficha10Solucao.Exercicio14(); //Ficha10Solucao.Exercicio15(); //Ficha10Solucao.Exercicio16(); //Ficha11Solucao.Exercicio71(); //Ficha11Solucao.Exercicio2(); //Ficha11Solucao.Exercicio3(); //Ficha11Solucao.Exercicio4(); //Ficha11Solucao.Exercicio5(); //Ficha11Solucao.Exercicio6(); //Ficha11Solucao.Exercicio7DoWhile(); //Ficha11Solucao.Exercicio7While(); //Ficha11Solucao.Exercicio7For(); //Ficha11Solucao.Exercicio8(); //Ficha11Solucao.Exercicio9(); //Ficha11Solucao.Exercicio10(); //Ficha11Solucao.Exercicio11(); //Ficha11Solucao.Exercicio12(); //Ficha11Solucao.Exercicio13(); //Ficha11Solucao.Exercicio14(); //Ficha11Solucao.Exercicio15(); //Ficha11Solucao.Exercicio16(); //Ficha11Solucao.Exercicio17(); //Ficha11Solucao.Exercicio18(); //Ficha12Solucao.Exercicio1(); //Ficha12Solucao.Exercicio2(); //Ficha12Solucao.Exercicio3(); //Ficha12Solucao.Exercicio4(); //Ficha12Solucao.Exercicio5(); //Ficha12Solucao.Exercicio6(); //Ficha12Solucao.Exercicio7(); //Ficha12Solucao.Exercicio8(); //Ficha12Solucao.Exercicio9(); //Ficha12Solucao.Exercicio10(); //Ficha12Solucao.Exercicio11(); //Ficha12Solucao.Exercicio12(); //Ficha12Solucao.Exercicio13(); //Ficha12Solucao.Exercicio14(); //Ficha12Solucao.Exercicio15(); //Ficha13Solucao.Calculadora(); //Ficha13Solucao.Forca(); //Ficha13Solucao.PalavraRandom(); //Ficha14Solucao.Exercicio1(); //Ficha14Solucao.Exercicio2(); //Ficha14Solucao.Exercicio3(); //Ficha14Solucao.Exercicio4(); //Ficha14Solucao.Exercicio5(); //Ficha14Solucao.Exercicio6(); //Ficha15Solucao.Exercicio1(); //Ficha15Solucao.Exercicio2(); //Ficha15Solucao.Exercicio3(); //Ficha15Solucao.Exercicio4(); //Ficha15Solucao.Exercicio5(); //Ficha15Solucao.Exercicio6(); //Ficha15Solucao.Exercicio7(); //Ficha15Solucao.Exercicio8(); //Ficha15Solucao.Exercicio9(); //Ficha16Solucao.Exercicio1(); //Ficha16Solucao.Exercicio2(); //Ficha16Solucao.Exercicio3(); //Ficha16Solucao.Exercicio4(); //Ficha16Solucao.Exercicio5(); //Ficha16Solucao.Exercicio6(); //Ficha16Solucao.Exercicio7(); //Ficha16Solucao.Exercicio8(); //Ficha17Solucao.Exercicio1(); //Ficha17Solucao.Exercicio2(); //Ficha17Solucao.Exercicio3(); //Ficha17Solucao.Exercicio4(); //Ficha17Solucao.Exercicio5(); //Ficha17Solucao.Exercicio6(); //Ficha17Solucao.Exercicio7(); //Testes.Testes.Summarize(); Car p1 = new Car("Peugeut", "208", 2007); Car p2 = new Car("Ferrari", "FXX", 2018); Console.WriteLine($"{p1.GetBrand()}-{p1.GetYear()}-{p1.GetModel()}"); Console.WriteLine($"{p2.GetBrand()}-{p2.GetYear()}-{p2.GetModel()}"); Car1 p3 = new Car1("Peugeut", "208", 2007); Car1 p4 = new Car1("Ferrari", "FXX", 2018); Console.WriteLine($"{p3.brand} {p3.model} {p3.year}"); Console.WriteLine($"{p4.brand} {p4.model} {p4.year}"); Products p5 = new Products("Banana", 1.98, Types.Fruit); Console.WriteLine($"{p5.GetName()} - {p5.GetPrice()} - {p5.GetType()}"); Products1 p6 = new Products1("Banana", 1.98, Types.Fruit); Console.WriteLine($"{p6.name} - {p6.price} - {p6.type}"); Player1 player1 = new Player1("Renaldo", 42, 1.65f, 20, Sponsor.Nyka); Console.WriteLine($"{player1.GetName()} - {player1.GetAge()} - {player1.GetHeight()} - {player1.GetWeight()} - {player1.GetSponsor()} - {player1.GetIMC()}"); Player2 player2 = new Player2("Messias", 39, 2.50f, 98, Sponsor.Acliclas); Console.WriteLine($"{player2.name} - {player2.age} - {player2.height} - {player2.weight} - {player2.sponsor} - {player2.imc}"); }
public bool Player1Wins() { return(Player1.Wins(Player2)); }
void Awake() //Executa quando o objeto entra em cena { _lMenager = GameObject.FindGameObjectWithTag("GameController").GetComponent <LevelMenager>(); _player = GameObject.FindGameObjectWithTag("Player1").GetComponent <Player1>(); }
public override void Fire(DiscreteDynamicsWorld world, Player1 player1) { //Fisica del disparo base.Fire(world, player1); }
public MoveLeft(Player1 player) { _player = player; }
void Start() { Controls = new Player1(); Cursor.visible = false; Cursor.lockState = CursorLockMode.Locked; }
public void TestPlayer1PullsOneAceFromPlayer2AndPlayer2Pulls2AcesFromPlayer1() { Player1 p1 = new Player1 { Hand = new List <Card> { new Card(Suits.Hjärter, Values.Ess), new Card(Suits.Hjärter, Values.Kung), new Card(Suits.Hjärter, Values.Dam), new Card(Suits.Hjärter, Values.Knekt), new Card(Suits.Hjärter, Values.Tio) } }; Player2 p2 = new Player2 { Hand = new List <Card> { new Card(Suits.Spader, Values.Ess), new Card(Suits.Spader, Values.Kung), new Card(Suits.Spader, Values.Dam), new Card(Suits.Spader, Values.Knekt), new Card(Suits.Spader, Values.Tio) } }; p1.Opponents = new List <BasePlayer> { p2 }; p2.Opponents = new List <BasePlayer> { p1 }; // Attach the announcement callbacks for each players actual exchange p1.CardExchangeAnnouncementCallback += p2.OtherPlayersPlayed; p2.CardExchangeAnnouncementCallback += p1.OtherPlayersPlayed; IEnumerable <Card> p1Recieved = p2.GetCards(Values.Ess); // Call the callbacks that announces the actual exchange p1.CardExchangeAnnouncementCallback?.Invoke(p1, p2, Values.Ess, p1Recieved); p2.CardExchangeAnnouncementCallback?.Invoke(p1, p2, Values.Ess, p1Recieved); int expectedHandCountp1 = 6; int expectedHandCountp2 = 4; int expectedKnownp1 = 1; int expectedKnownp2 = 0; Assert.AreEqual(expectedHandCountp1, p1.Hand.Count); Assert.AreEqual(expectedHandCountp2, p2.Hand.Count); Assert.AreEqual(expectedKnownp1, p1.SwappedCards["Player1"].Count); Assert.AreEqual(expectedKnownp1, p2.SwappedCards["Player1"].Count); Assert.AreEqual(expectedKnownp2, p1.SwappedCards["Player2"].Count); Assert.AreEqual(expectedKnownp2, p2.SwappedCards["Player2"].Count); IEnumerable <Card> p2Recieved = p1.GetCards(Values.Ess); p1.CardExchangeAnnouncementCallback?.Invoke(p2, p1, Values.Ess, p2Recieved); p2.CardExchangeAnnouncementCallback?.Invoke(p2, p1, Values.Ess, p2Recieved); expectedHandCountp1 = 4; expectedHandCountp2 = 6; expectedKnownp1 = 0; expectedKnownp2 = 2; Assert.AreEqual(expectedHandCountp1, p1.Hand.Count); Assert.AreEqual(expectedHandCountp2, p2.Hand.Count); Assert.AreEqual(expectedKnownp1, p1.SwappedCards["Player1"].Count); Assert.AreEqual(expectedKnownp1, p2.SwappedCards["Player1"].Count); Assert.AreEqual(expectedKnownp2, p1.SwappedCards["Player2"].Count); Assert.AreEqual(expectedKnownp2, p2.SwappedCards["Player2"].Count); }
void Start() { player = gameObject.GetComponentInParent <Player1>(); }
public void Setup() { player1 = new Player1(); player2 = new Player2(); ball = new Ball(); }
public void SendGlobalMessage(string message) { SendMessage(message); Player1.SendMessage(message); Player2.SendMessage(message); }
void Awake() { _player1 = GameObject.FindGameObjectWithTag("Player1").GetComponent <Player1>(); }
// 解決 public void Resolve() { if (!IsAnimationOver) { return; } if (currentIndex >= rule.CountOfMoment.Value) { TurnEnd(); DealCards(); CurrentPhase = Phase.MovePlot; resolveState = 0; currentIndex = -1; return; } if (currentIndex < 0) { return; } IList <IAction> p1Actions = Player1.GetActualActions(rule.CountOfMoment.Value, this); IList <IAction> p2Actions = Player2.GetActualActions(rule.CountOfMoment.Value, this); int cindex = currentIndex < 0 ? 0 : currentIndex; IAction p1a = p1Actions[cindex]; IAction p2a = p2Actions[cindex]; switch (resolveState) { case 0: // カウンター状態のクリア Player1.Cotton = false; Player1.BigCounter = false; Player1.Counter = false; Player2.Cotton = false; Player2.BigCounter = false; Player2.Counter = false; // 先制移動処理 ResolveMoveAnim(p1a.ExpectedRapidMove(cindex, Player1), p2a.ExpectedRapidMove(cindex, Player2)); resolveState = 1; break; case 1: ResolveMove(p1a.ExpectedRapidMove(cindex, Player1), p2a.ExpectedRapidMove(cindex, Player2)); // 決着判定 if (IsSettled()) { CurrentPhase = Phase.Settle; resolveState = 0; return; } resolveState = 2; break; case 2: // 先制攻撃処理 ResolveRapidAttackAnim(p1a, p2a, cindex); resolveState = 3; break; case 3: // 先制攻撃処理 ResolveRapidAttack(p1a, p2a, cindex); // 決着判定 if (IsSettled()) { CurrentPhase = Phase.Settle; resolveState = 0; return; } resolveState = 4; break; case 4: ResolveCounterAnim(p1a, p2a, cindex); resolveState = 5; break; case 5: ResolveCounter(p1a, p2a, cindex); // 決着判定 if (IsSettled()) { CurrentPhase = Phase.Settle; resolveState = 0; return; } resolveState = 6; break; case 6: ResolveActionAttackAnim(p1a, p2a, cindex); resolveState = 7; break; case 7: ResolveActionAttack(p1a, p2a, cindex); // 決着判定 if (IsSettled()) { CurrentPhase = Phase.Settle; resolveState = 0; return; } resolveState = 8; break; case 8: ResolveMoveAnim( Player1.Gradiator.RelativePosToAbsolute(p1a.ExpectedActionMove(cindex, Player1).ToRelativePos()), Player2.Gradiator.RelativePosToAbsolute(p2a.ExpectedActionMove(cindex, Player2).ToRelativePos())); resolveState = 9; break; case 9: ResolveMove( Player1.Gradiator.RelativePosToAbsolute(p1a.ExpectedActionMove(cindex, Player1).ToRelativePos()), Player2.Gradiator.RelativePosToAbsolute(p2a.ExpectedActionMove(cindex, Player2).ToRelativePos())); // 決着判定 if (IsSettled()) { CurrentPhase = Phase.Settle; resolveState = 0; return; } resolveState = 10; break; case 10: ResolveMoveAnim(p2a.ExpectedEnemyMove(cindex, Player2), p1a.ExpectedEnemyMove(cindex, Player1)); resolveState = 11; break; case 11: ResolveMove(p2a.ExpectedEnemyMove(cindex, Player2), p1a.ExpectedEnemyMove(cindex, Player1)); // 決着判定 if (IsSettled()) { CurrentPhase = Phase.Settle; resolveState = 0; return; } resolveState = 12; break; case 12: resolveState = 0; currentIndex++; break; } }
// Start is called before the first frame update public void Start() { deadTime = Time.time + 2; player1 = (Player1)FindObjectOfType(typeof(Player1)); }
private void Awake() { player1 = GameObject.FindGameObjectWithTag("Player1").GetComponent <Player1>(); player2 = GameObject.FindGameObjectWithTag("Player2").GetComponent <Player2>(); _fightSytem = GetComponent <FightSystem>(); }
/// <summary> /// Plays the next turn in the game. /// </summary> private void NextTurn() { totalTurns++; // the play area represents the area on the "table" where all cards would // normally be in play. An ICollection is used to serve as a type of card // pool since the winner of the round takes all cards. ICollection <Card> playArea = new List <Card>(); // each player plays the card on top of their deck Card p1Card = Player1.Deck.Dequeue(); Card p2Card = Player2.Deck.Dequeue(); // the cards are then added to the play area playArea.Add(p1Card); playArea.Add(p2Card); // check to see if war has been triggered // this comparison is a while loop because the war condition can be triggered // a number of times in sequence. Doing it this way demands that the final // cards drawn for each player be different before doing the final comparison // to see who won the round. while (p1Card.Value == p2Card.Value) { Console.WriteLine(SEPERATOR); Console.WriteLine("WAR!!!"); // make sure each player has enough cards for war. // if you don't have enough cards, you can't go to war // and you automatically lose. // similar enough to real life to make sense - you can't go to war without proper supplies. // Since the GameOver() method checks to see if any of the players is out of cards, // the player without enough cards for war has their deck discarded which forces an end to the game. if (!PlayerHasEnoughCardsForWar(Player1)) { Player1.Deck.Clear(); Console.WriteLine($"{Player1.Name} doesn't have enough cards for war.\n{Player2.Name} wins!"); break; } if (!PlayerHasEnoughCardsForWar(Player2)) { Player2.Deck.Clear(); Console.WriteLine($"{Player2.Name} doesn't have enough cards for war.\n{Player1.Name} wins!"); break; } // the rules of war dictate that each user must add one card face down // and then add another face up and the second card drawn in that sequence // is the one used for determining the winner of war and the round // this operates the same way as beginning a turn, including adding each card // drawn to the play area for collection by the winner playArea.Add(Player1.Deck.Dequeue()); playArea.Add(Player2.Deck.Dequeue()); p1Card = Player1.Deck.Dequeue(); p2Card = Player2.Deck.Dequeue(); playArea.Add(p1Card); playArea.Add(p2Card); } // determine winner and assign cards in play area to winner if (p1Card.Value > p2Card.Value) { Console.WriteLine(SEPERATOR); Console.WriteLine($"{Player1.Name} wins the round!"); Player1.AddCardsToDeck(playArea); } else if (p1Card.Value < p2Card.Value) { Console.WriteLine(SEPERATOR); Console.WriteLine($"{Player2.Name} wins the round!"); Player2.AddCardsToDeck(playArea); } Console.WriteLine($"{Player1.Name} played: " + p1Card); Console.WriteLine($"{Player2.Name} played: " + p2Card); Console.WriteLine($"Turns taken: {totalTurns}"); playArea.Clear(); // A game of War without shuffling each player's deck every so often can run indefinitely (or seem to). // Some variants of the classic game suggest that a player must shuffle their deck at various // intervals or when they have used all of their cards before using the cards they have won // since the last time they shuffled. // Since a previously run simulation has taken upwards of 3.2 million turns, a good middle ground // is to shuffle on a specified interval. This greatly improves the speed of a game. // Most of the games that use this logic end well before 1000 turns. if (totalTurns % SHUFFLE_INTERVAL == 0) { ShufflePlayerDeck(Player1); ShufflePlayerDeck(Player2); } }
// Determine whether an action is applicable public bool CheckActionApplicable(WorldAction action) { return(Player1.CheckActionApplicable(action) && Player2.CheckActionApplicable(action)); }
public static void Main(string[] _) { Initialize(); Guid PlayerId = Guid.NewGuid(); string Player1Name; string Player2Name; Console.Out.WriteLine("Welcome to Mask! (Worms/Tron)"); Console.Out.WriteLine(new string('-', 70)); Console.Out.WriteLine("You control the work using the cursor keys."); Console.Out.WriteLine("Fire, using SPACE."); Console.Out.WriteLine("If you die, press ENTER to restart the game."); Console.Out.WriteLine("You can chat during the game."); Console.Out.WriteLine("Remember to try to fetch the gifts. You do that by moving into them."); Console.Out.WriteLine(); Console.Out.WriteLine("Hello. What is your name?"); Player1Name = Player2Name = Console.ReadLine(); using (MPE = new MultiPlayerEnvironment("Mask", false, "iot.eclipse.org", 1883, false, string.Empty, string.Empty, "RetroSharp/Examples/Games/Mask", 2, PlayerId, new KeyValuePair <string, string>("NAME", Player1Name))) { MPE.OnStateChange += (sender, state) => { switch (state) { case MultiPlayerState.SearchingForGateway: Console.Out.WriteLine("Searching for Internet Gateway."); break; case MultiPlayerState.RegisteringApplicationInGateway: Console.Out.WriteLine("Registering game in gateway."); break; case MultiPlayerState.FindingPlayers: Console.Out.WriteLine("Waiting for another player to connect."); Console.Out.WriteLine("Press ESC to play in single player mode."); OnKeyDown += new KeyEventHandler(MPE_Wait_OnKeyDown); break; case MultiPlayerState.ConnectingPlayers: Console.Out.WriteLine("Connecting to players."); break; } }; MPE.OnPlayerAvailable += (sender, player) => { Console.Out.WriteLine("New player available: " + player["NAME"]); MPE.ConnectPlayers(); }; MPE.OnPlayerConnected += (sender, player) => { Player2Name = player["NAME"]; }; MPE.OnPlayerDisconnected += (sender, player) => { PlayerMsg(2, "Disconnected"); NrPlayers = 1; LocalMachineIsGameServer = true; }; if (MPE.Wait(int.MaxValue)) { NrPlayers = MPE.PlayerCount; LocalMachineIsGameServer = MPE.LocalPlayerIsFirst; } else { PlayerMsg(2, "Network error"); NrPlayers = 1; } OnKeyDown -= new KeyEventHandler(MPE_Wait_OnKeyDown); ManualResetEvent Done = new ManualResetEvent(false); LinkedList <Shot> Shots = new LinkedList <Shot>(); LinkedList <Explosion> Explosions = new LinkedList <Explosion>(); LinkedList <Present> Presents = new LinkedList <Present>(); LinkedList <PlayerPosition> Player2Positions = new LinkedList <PlayerPosition>(); Player Player1 = new Player(1, 20, 28, 1, 0, 3, Color.Green, Color.LightGreen, 15); Player Player2 = new Player(2, 299, 179, -1, 0, 3, Color.Blue, Color.LightBlue, 15); bool Player1Up = false; bool Player1Down = false; bool Player1Left = false; bool Player1Right = false; bool Player1Fire = false; bool Player2Up = false; bool Player2Down = false; bool Player2Left = false; bool Player2Right = false; bool Player2Fire = false; Player1.Opponent = Player2; Player2.Opponent = Player1; Clear(); FillRectangle(0, 0, 319, 7, Color.FromKnownColor(KnownColor.DimGray)); SetClipArea(0, 8, 319, 199); string s = Player1Name.Length <= 10 ? Player1Name : Player1Name.Substring(0, 10); Console.Out.Write(s); s = Player2Name.Length <= 10 ? Player2Name : Player2Name.Substring(0, 10); GotoXY(ConsoleWidth - s.Length, 0); Console.Out.Write(s); OnKeyDown += (sender, e) => { switch (e.Key) { case Key.Escape: if (MPE.State == MultiPlayerState.FindingPlayers) { MPE.ConnectPlayers(); } else { Done.Set(); } break; case Key.C: if (e.Control) { Done.Set(); } break; case Key.Up: if (!Player1.Dead && Player1.VY != 1) { Player1Up = true; if (NrPlayers == 1) { if (!Player2.Dead) { Player2Down = true; } } else { MPE.SendUdpToAll(new byte[] { 0 }, 3); } } break; case Key.Down: if (!Player1.Dead && Player1.VY != -1) { Player1Down = true; if (NrPlayers == 1) { if (!Player2.Dead) { Player2Up = true; } } else { MPE.SendUdpToAll(new byte[] { 1 }, 3); } } break; case Key.Left: if (!Player1.Dead && Player1.VX != 1) { Player1Left = true; if (NrPlayers == 1) { if (!Player2.Dead) { Player2Right = true; } } else { MPE.SendUdpToAll(new byte[] { 2 }, 3); } } break; case Key.Right: if (!Player1.Dead && Player1.VX != -1) { Player1Right = true; if (NrPlayers == 1) { if (!Player2.Dead) { Player2Left = true; } } else { MPE.SendUdpToAll(new byte[] { 3 }, 3); } } break; case Key.Space: if (!Player1.Dead) { Player1Fire = true; if (NrPlayers == 1) { if (!Player2.Dead) { Player2Fire = true; } } else { MPE.SendUdpToAll(new byte[] { 4 }, 3); } } break; case Key.Enter: if (Player1.Dead) { if (NrPlayers > 1) { MPE.SendUdpToAll(new byte[] { 5 }, 3); } else { lock (Player2Positions) { Player2Positions.Clear(); } Shots.Clear(); Explosions.Clear(); Presents.Clear(); Player1 = new Player(1, 20, 28, 1, 0, 3, Color.Green, Color.LightGreen, 15); Player2 = new Player(2, 299, 179, -1, 0, 3, Color.Blue, Color.LightBlue, 15); Player1Up = false; Player1Down = false; Player1Left = false; Player1Right = false; Player1Fire = false; Player1.Opponent = Player2; Player2.Opponent = Player1; FillRectangle(0, 8, 319, 199, Color.Black); PlayerMsg(1, string.Empty); PlayerMsg(2, string.Empty); } } break; } }; OnKeyPressed += (sender, e) => { ChatCharacter(1, e.Character); MPE.SendTcpToAll(new byte[] { 10, (byte)(e.Character >> 8), (byte)(e.Character) }); }; OnUpdateModel += (sender, e) => { if (LocalMachineIsGameServer && Random() < 0.005) { int x1, y1; do { x1 = Random(30, 285); y1 = Random(38, 165); }while (!Present.CanPlace(x1, y1, x1 + 5, y1 + 5)); Presents.AddLast(new Present(x1, y1, x1 + 5, y1 + 5)); if (NrPlayers > 1) { BinaryOutput Output = new BinaryOutput(); Output.WriteByte(6); Output.WriteInt(x1); Output.WriteInt(y1); MPE.SendUdpToAll(Output.GetPacket(), 3); } } LinkedListNode <Present> PresentObj, NextPresentObj; PresentObj = Presents.First; while (!(PresentObj is null)) { NextPresentObj = PresentObj.Next; if (PresentObj.Value.Move()) { Presents.Remove(PresentObj); } PresentObj = NextPresentObj; } if (Player1Up) { Player1.Up(); Player1Up = false; } else if (Player1Down) { Player1.Down(); Player1Down = false; } else if (Player1Left) { Player1.Left(); Player1Left = false; } else if (Player1Right) { Player1.Right(); Player1Right = false; } if (Player2Up) { Player2.Up(); Player2Up = false; } else if (Player2Down) { Player2.Down(); Player2Down = false; } else if (Player2Left) { Player2.Left(); Player2Left = false; } else if (Player2Right) { Player2.Right(); Player2Right = false; } if (!Player1.Dead && Player1.Move()) { Explosions.AddLast(new Explosion(Player1.X, Player1.Y, 30, Color.White)); } if (!Player2.Dead) { if (NrPlayers == 1) { if (Player2.Move()) { Explosions.AddLast(new Explosion(Player2.X, Player2.Y, 30, Color.White)); } } else { lock (Player2Positions) { try { foreach (PlayerPosition P in Player2Positions) { Player2.BeforeMove(); Player2.SetPosition(P.X, P.Y, P.VX, P.VY); Player2.AfterMove(); if (P.Dead) { Player2.Die(); Explosions.AddLast(new Explosion(Player2.X, Player2.Y, 30, Color.White)); } } } finally { Player2Positions.Clear(); } } } } if (Player1Fire) { Player1.Fire(Shots); Player1Fire = false; } if (Player2Fire) { Player2.Fire(Shots); Player2Fire = false; } LinkedListNode <Shot> ShotObj, NextShotObj; ShotObj = Shots.First; while (!(ShotObj is null)) { NextShotObj = ShotObj.Next; if (ShotObj.Value.Move()) { Shots.Remove(ShotObj); Explosions.AddLast(new Explosion(ShotObj.Value.X, ShotObj.Value.Y, ShotObj.Value.Power, Color.White)); } ShotObj = NextShotObj; } LinkedListNode <Explosion> ExplosionObj, NextExplosionObj; ExplosionObj = Explosions.First; while (!(ExplosionObj is null)) { NextExplosionObj = ExplosionObj.Next; if (ExplosionObj.Value.Move()) { Explosions.Remove(ExplosionObj); } ExplosionObj = NextExplosionObj; } }; MPE.OnGameDataReceived += (sender, e) => { byte Command = e.Data.ReadByte(); switch (Command) { case 0: // Remote player presses UP if (!Player2.Dead) { Player2Down = true; } break; case 1: // Remote player presses DOWN if (!Player2.Dead) { Player2Up = true; } break; case 2: // Remote player presses LEFT if (!Player2.Dead) { Player2Right = true; } break; case 3: // Remote player presses RIGHT if (!Player2.Dead) { Player2Left = true; } break; case 4: // Remote player presses SPACE (Fire) if (!Player2.Dead) { Player2Fire = true; } break; case 5: // Remote player presses ENTER (Restart) case 9: // Acknowledgement of remote player presses ENTER (Restart) if (Command == 5) { MPE.SendUdpToAll(new byte[] { 9 }, 3); } lock (Player2Positions) { Player2Positions.Clear(); } Shots.Clear(); Explosions.Clear(); Presents.Clear(); Player1 = new Player(1, 20, 28, 1, 0, 3, Color.Green, Color.LightGreen, 15); Player2 = new Player(2, 299, 179, -1, 0, 3, Color.Blue, Color.LightBlue, 15); Player1Up = false; Player1Down = false; Player1Left = false; Player1Right = false; Player1Fire = false; Player1.Opponent = Player2; Player2.Opponent = Player1; FillRectangle(0, 8, 319, 199, Color.Black); PlayerMsg(1, string.Empty); PlayerMsg(2, string.Empty); BorderColor = Color.FromKnownColor(KnownColor.DimGray); break; case 6: // New Present int x1 = 315 - (int)e.Data.ReadInt(); int y1 = 203 - (int)e.Data.ReadInt(); Presents.AddLast(new Present(x1, y1, x1 + 5, y1 + 5)); break; case 7: // Gift x1 = (int)e.Data.ReadInt(); Player2.GetGift(2, x1, null, e.Data); break; case 8: // Move player 2 lock (Player2Positions) { Player2Positions.AddLast(new PlayerPosition(e.Data)); } break; case 10: // chat character char ch = (char)e.Data.ReadUInt16(); ChatCharacter(2, ch); break; } }; while (!Done.WaitOne(1000)) { ; } } Terminate(); }
public MoveForward(Player1 player) { _player = player; }
private async Task MainLoop() { while (true) { try { if (_nextState == GameState.P2NotInitialized) { if (Player2 == null || !Player2.StreamOpened) { _logger.Info("Waiting for second player to initialize"); while (Player2 == null) { await Task.Delay(50); } } } else if (_nextState == GameState.P1Req) { await _p1ReqStream.MoveNext(); Player1.LatestMove = _p1ReqStream.Current; _logger.Info($"{(Player1.Information.Name + ":").PadRight(12)} Received move {Player1.PrintLatest()}"); _logger.Info($"{(Player1.Information.Name + ":").PadRight(12)} {Player1.LatestMove.Diagnostics}"); if (Player2 == null || !Player2.StreamOpened) { lock (_stateLock) _nextState = GameState.P2NotInitialized; } else { lock (_stateLock) _nextState = GameState.P2Res; } } else if (_nextState == GameState.P2Res) { await _p2ResStream.WriteAsync(Player1.LatestMove.Move); _logger.Info($"Sent p1 move to p2"); lock (_stateLock) _nextState = GameState.P2Req; } else if (_nextState == GameState.P2Req) { await _p2ReqStream.MoveNext(); Player2.LatestMove = _p2ReqStream.Current; _logger.Info($"{(Player2.Information.Name + ":").PadRight(12)} Received move {Player2.PrintLatest()}"); _logger.Info($"{(Player2.Information.Name + ":").PadRight(12)} {Player2.LatestMove.Diagnostics}"); lock (_stateLock) _nextState = GameState.P1Res; } else if (_nextState == GameState.P1Res) { await _p1ResStream.WriteAsync(Player2.LatestMove.Move); _logger.Info($"Sent p2 move to p1"); lock (_stateLock) _nextState = GameState.P1Req; } } catch (Exception e) { _logger.Error(e, $"Game loop ended to exception {e.Message}"); return; } await Task.Delay(100); } }
// Use this for initialization void Start() { startPos = transform.position; extendToX = new Vector3(extendAmount,0f,0f); extendToY = new Vector3(0f,extendAmount,0f); yExtend = transform.position - extendToY; xExtend = transform.position - extendToX; player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player1>(); triggerHit = 0; }
public void Game() { TempCards = new List <Card>(); Console.WriteLine("Let's play the Drunkard! The rules are very simple:each of the players throws the top card of his deck onto the table." + "A player whose card is older takes all the cards from the table and puts them under the bottom of his deck.Ace is older than all cards except six."); Console.WriteLine("Press any key to start the game."); Console.ReadKey(); int count = 0; while (Player1.Count != 0 && Player2.Count != 0) { Console.WriteLine($"\nYour card is: {Player1[0]}. My card is: {Player2[0]}"); Thread.Sleep(200); if ((int)Player1[0].Value > (int)Player2[0].Value) { if (Player1[0].Value == CardValue.Ace && Player2[0].Value == CardValue.six) { TakeCards(Player1, Player2); Player2.AddRange(TempCards.GetRange(0, TempCards.Count)); TempCards.Clear(); Console.WriteLine($"I take your card. There are {Player1.Count} cards in your deck, and {Player2.Count} in mine."); } else { TakeCards(Player2, Player1); Player1.AddRange(TempCards.GetRange(0, TempCards.Count)); TempCards.Clear(); Console.WriteLine($"You take my card. There are {Player1.Count} cards in your deck, and {Player2.Count} in mine."); } } else if ((int)Player1[0].Value < (int)Player2[0].Value) { if (Player2[0].Value == CardValue.Ace && Player1[0].Value == CardValue.six) { TakeCards(Player2, Player1); Player1.AddRange(TempCards.GetRange(0, TempCards.Count)); TempCards.Clear(); Console.WriteLine($"You take my card. There are {Player1.Count} cards in your deck, and {Player2.Count} in mine."); } else { TakeCards(Player1, Player2); Player2.AddRange(TempCards.GetRange(0, TempCards.Count)); TempCards.Clear(); Console.WriteLine($"I take your card. There are {Player1.Count} cards in your deck, and {Player2.Count} in mine."); } } else { EqualCards(Player1, Player2); Console.WriteLine("We have equal cards.These cards will be taken by the player who wins the next turn."); } if (Player1.Count == 0) { Console.WriteLine("You won!"); } else if (Player2.Count == 0) { Console.WriteLine("I won!"); } count++; if (count > 500) { Console.WriteLine("It's too boring. Let's drink better"); break; } } }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player1>(); startPos = transform.position; }
void Start() { player1 = FindObjectOfType <Player1>(); }
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player1>(); }
public MoveRight(Player1 player) { _player = player; }
void OnTriggerExit2D(Collider2D other) { //reset the player to equal nothing when they leave the spike player = null; }
// Use this for initialization void Start() { coinAmount = resetCoinAmount; player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player1>(); }