protected override IEnumerator cancelEffect(AlivePlayer alive, GhostPlayer ghost) { yield return(new WaitForSeconds(alive.currentSkill.duration)); alive.hasEffect = false; yield break; }
public virtual void applyEffect(AlivePlayer alive, GhostPlayer ghost) { alive.hasEffect = true; IEnumerator corotine = cancelEffect(alive, ghost); StartCoroutine(corotine); }
/// <summary> /// A test harness for the GhostGame class. /// </summary> /// <param name="args"> The command line arguments passed in. </param>f public static void Main(string[] args) { if (args.Length == 3) { GhostGame game = null; Type typePlayer1 = GetPlayerType(args[1]); Type typePlayer2 = GetPlayerType(args[2]); try { GhostPlayer playerOne = (GhostPlayer)Activator.CreateInstance(typePlayer1); GhostPlayer playerTwo = (GhostPlayer)Activator.CreateInstance(typePlayer2); game = new GhostGame(args[0], playerOne, playerTwo); } catch (Exception e) { Console.WriteLine("Unable to initialize GhostGame: " + e.ToString()); } GhostPlayer winner = game.Play(); Console.WriteLine("Final word: " + game.WordInPlay() + ", " + winner.Name() + " wins!"); } else { Console.WriteLine("Usage: GhostGame" + typeof(GhostGame).FullName + " <word-list> <player-one> <player-two>"); } }
public void OnTriggerEnter(Collider other) { if (other.tag == "Player") { GhostPlayer player = other.GetComponentInParent <GhostPlayer>(); //StartCoroutine(player.Death(this,rb)); } }
protected override IEnumerator cancelEffect(AlivePlayer alive, GhostPlayer ghost) { yield return(new WaitForSeconds(alive.currentSkill.duration)); alive.hasEffect = false; alive.blackholeObject.color = new Color(0, 0, 0, 0.431f); yield break; }
public static void WriteGhostPlayerData(string filename, GhostPlayer gp) { #if !UNITY_EDITOR XmlSerializer xmlSerializer = new XmlSerializer(typeof(GhostPlayer)); FileStream fileStream = new FileStream("ux0:" + Path.DirectorySeparatorChar + "data" + "/" + filename, FileMode.Create); xmlSerializer.Serialize(fileStream, gp); fileStream.Close(); #endif }
protected override void Draw(GameTime gameTime) { if (Level.DisplayingWinScreen) { winScreen.LoadContent(Content); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise, null, GameCamera.Transform); winScreen.Draw(spriteBatch); spriteBatch.End(); } else if (Level.DisplayingGameOverScreen) { gameOverScreen.LoadContent(Content); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise, null, GameCamera.Transform); gameOverScreen.Draw(spriteBatch); spriteBatch.End(); } else if (Level.DisplayingRemainingLivesScreen) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise, null, GameCamera.Transform); remainingLivesScreen.Draw(spriteBatch); hud.Draw(spriteBatch); if (ElapsedTime > GameUtility.RemainingLivesScreenTime) { Level.DisplayingRemainingLivesScreen = false; } ElapsedTime++; spriteBatch.End(); } else { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise, null, GameCamera.Transform); Player.Draw(spriteBatch); if (GhostPlayer != null) { GhostPlayer.Draw(spriteBatch); } foreach (IEntity e in Entities) { if (GameCamera.IsOnScreen(e)) { e.Draw(spriteBatch); } } hud.Draw(spriteBatch); spriteBatch.End(); } base.Draw(gameTime); }
/// <summary> /// Add a letter to the word in play. /// </summary> private void AddLetter(char letter) { _wordInPlay.Append(letter); if (_dictionary.IsFullWord(_wordInPlay.ToString()) || !_dictionary.IsWordStem(_wordInPlay.ToString())) { _gameOver = true; _winner = _players[SwitchPlayer()]; } }
/// <summary> /// The full constructor for the GhostGame class. /// </summary> /// <param name="fileName"> The name of the dictionary file. </param> /// <param name="playerOne"> A reference to the first player. </param> /// <param name="playerTwo"> A reference to the second player. </param> public GhostGame(string fileName, GhostPlayer playerOne, GhostPlayer playerTwo) { _dictionary = new GhostDictionary(fileName); if (_dictionary.Size() == 0) { throw new Exception("Unable to load dictionary from " + fileName + "."); } _players[0] = playerOne; _players[1] = playerTwo; }
public override void applyEffect(AlivePlayer alive, GhostPlayer ghost) { base.applyEffect(alive, ghost); Vector3 lastPos = ghost.transform.position; ghost.isSkillAvaible = true; alive.hasEffect = false; alive.myPhaseController.CmdSaySwitch(alive.transform.position, true, ghost.id); alive.myPhaseController.CmdSaySwitch(lastPos, false, alive.id); }
void Awake() { if (instance == null) { instance = this; animator = GetComponent <Animator>(); spriteRender = GetComponent <SpriteRenderer>(); } else { Destroy(gameObject); } }
/// <summary> /// When color is sure to be free. /// Only issued by lobby host. /// Received by anyone /// </summary> public void ClaimColor(string playerUID, MeepleColor color) { Console.WriteLine("claiming {0} for {1}", color.ToString(), playerUID); GhostPlayer targetPlayer = PlayerManager.Instance().GetByUID(playerUID); targetPlayer.MeepleColor = color; targetPlayer.colorIsClaimed = true; NotifyObservers(); if (PlayerManager.Instance().local.isLobbyHost) { available.Remove(color); } }
// Update is called once per frame void FixedUpdate() { if (!GameManager.IsPaused()) { if (!WorldManager.IsWorldFuture()) { grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, WorldManager.PresentWorldLayer()); } else { grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, WorldManager.FutureWorldLayer()); } animator.SetBool("Ground", grounded); animator.SetFloat("vSpeed", rigidbody2D.velocity.y); GhostPlayer.Grounded(grounded); GhostPlayer.VSpeed(rigidbody2D.velocity.y); if (grounded) { doubleJump = false; } /** Check if the player is stuck against a wall **/ float move = Input.GetAxisRaw("Horizontal"); if (wallHit && !grounded) { animator.SetFloat("Speed", 0f); GhostPlayer.Move(0f); rigidbody2D.velocity = new Vector2(0f, rigidbody2D.velocity.y); } else { animator.SetFloat("Speed", Mathf.Abs(move)); GhostPlayer.Move(Mathf.Abs(move)); rigidbody2D.velocity = new Vector2(move * maxSpeed, rigidbody2D.velocity.y); } if ((move > 0 && !facingRight) || (move < 0 && facingRight)) { Flip(); } } }
void Update() { if (!GameManager.IsPaused()) { if ((grounded || (!doubleJump && doubleJumpEnabled)) && Input.GetButtonDown("Jump")) { animator.SetBool("Ground", false); GhostPlayer.Grounded(false); rigidbody2D.AddForce(new Vector2(0, jumpForce)); if (!doubleJump && !grounded) { doubleJump = true; } } } }
void Start() { rnd = Random.Range(0, 2); player = GameObject.Find("Player").GetComponent <GhostPlayer>(); animator = GetComponent <Animator>(); exerciser = GetComponent <LocomotionController>(); //transform.Rotate(new Vector3(-90, 180, 0)); //chase = Random.Range(0, 3); //if (chase == 2) //{ // if (!player) // return; // Vector3 dir = player.transform.position - transform.position; // exerciser.DynamicDirectionChange(dir / 2); //} }
public static GhostPlayer ReadGhostPlayerData(string filename) { #if !UNITY_EDITOR XmlSerializer xmlSerializer = new XmlSerializer(typeof(GhostPlayer)); GhostPlayer result = new GhostPlayer(); try { FileStream fileStream = new FileStream("ux0:" + Path.DirectorySeparatorChar + "data" + "/" + filename, FileMode.Open); result = (xmlSerializer.Deserialize(fileStream) as GhostPlayer); fileStream.Close(); } catch { } return(result); #else GhostPlayer result = new GhostPlayer(); return(result); #endif }
public IEnumerator TeleportToFuture() { Player.SwitchWorld(); //change the transparence of the ghost GhostPlayer.SetVisible(); // close the gate yield return(MaskController.instance.CloseGateAsync()); // go back to transparent GhostPlayer.SetTranparent(); // hide the second camera WorldManager.SwitchWorld(); // UI UIPowerBar.RemoveListener(); UIPowerBar.StartRegen(); Player.instance.wallHit = false; }
public void Play() { GhostGame.GhostGame game = null; Type typePlayer1 = typeof(HumanWebPlayer); Type typePlayer2 = typeof(ComputerPlayer); try { GhostPlayer playerOne = (GhostPlayer)Activator.CreateInstance(typePlayer1); GhostPlayer playerTwo = (GhostPlayer)Activator.CreateInstance(typePlayer2); game = new GhostGame.GhostGame(_filePath, playerOne, playerTwo); } catch (Exception e) { Console.WriteLine("Unable to initialize GhostGame: " + e.ToString()); } GhostPlayer winner = game.Play(); Console.WriteLine("Final word: " + game.WordInPlay() + ", " + winner.Name() + " wins!"); }
void Start() { MyNetManager.instance.addPlayer(this); MyNetManager.instance.getSpawnPoint(this.transform); GetMyId(); alive = aliveObject.GetComponent <AlivePlayer> (); ghost = ghostObject.GetComponent <GhostPlayer> (); alive.id = id; ghost.id = id; alive.transform.position = transform.position; ghost.transform.position = Vector3.zero; alive.myPhaseController = this; ghost.myPhaseController = this; if (hasAuthority) { MyNetManager.instance.attachCamera(alive); StartCoroutine("waitBeforeSendBlanks"); //FindObjectOfType<CameraPivot> ().player = aliveObject.transform; UIController.instance.alivePlyer = alive; UIController.instance.ghostPlayer = ghost; } ghostObject.SetActive(false); }
public override void applyEffect(AlivePlayer alive, GhostPlayer ghost) { base.applyEffect(alive, ghost); alive.myPhaseController.CmdGetDamage(1); }
public static GameOverCommand FromSerializable(SerializableCommand sCommand) { GhostPlayer winner = PlayerManager.Instance().GetByUID(sCommand.UID); return(new GameOverCommand(winner)); }
public static void OnGameOver4Real(GhostPlayer winner) { setupper.GameOver(winner.name); }
public GameOverCommand(GhostPlayer winner) { this.winner = winner; }
protected override void Update(GameTime gameTime) { if (!Level.DisplayingRemainingLivesScreen && !Level.DisplayingWinScreen) { foreach (IController input in inputs) { input.Update(); } if (paused) { return; } Player.Update(); if (GhostPlayer != null) { GhostPlayer.Update(); } foreach (IEntity e in Entities) { e.Update(); } DetectCollisions(); GameCamera.SpotlightCameraPosition = new Vector2(Player.Location.X + Player.Sprite.Width, Player.Location.Y + Player.Sprite.Height); GameCamera.Update(gameTime); foreach (ICommand c in CommandQueue) { c.Execute(); } CommandQueue.Clear(); ticks--; if (ticks % GameUtility.FramesPerSecond == 0) { Stats.Time--; } if (Stats.Coins >= GameUtility.NumCoinsToIncreaseLives) { Stats.Lives++; Stats.Coins -= GameUtility.NumCoinsToIncreaseLives; } } else { CommandQueue.Clear(); GameCamera.SpotlightCameraPosition = new Vector2(Player.Location.X + Player.Sprite.Width, Player.Location.Y + Player.Sprite.Height); GameCamera.Update(gameTime); foreach (IController input in inputs) { input.Update(); } foreach (ICommand c in CommandQueue) { c.Execute(); } } base.Update(gameTime); }
public override void applyEffect(AlivePlayer alive, GhostPlayer ghost) { base.applyEffect(alive, ghost); alive.blackholeObject.color = new Color(0, 0, 0, 1); }
public GhostMeeple(GhostPlayer player, Rectangle position, string UID, int zPosition = defaultZPosition, int meepIdx = 0) : base(position, Texture4Color(player.MeepleColor), UID, zPosition) { this.ghostPlayer = player; this.meepIdx = meepIdx; CommandQueue.Queue(new AddGhostMeepleToPlayerManager(this)); }
public GhostMeeple(GhostPlayer player, PyramidFloorBoardElement standingOn, string UID, int zPosition = defaultZPosition, int meepIdx = 0) : this(player, standingOn.Position, UID, zPosition, meepIdx) { this.standingOn = standingOn; }
private void Awake() { ghostPlayer = GetComponent <GhostPlayer>(); mouseLook = GetComponent <MouseLook>(); }
public RemoveGhostPlayerFromManagerCommand(GhostPlayer player) { this.player = player; }
public override void applyEffect(AlivePlayer alive, GhostPlayer ghost) { base.applyEffect(alive, ghost); alive.InverseKof = -1; }