// Use this for initialization void Start() { //Set variables doorPos = door.transform.position; player1 = FindObjectOfType <Player1Movement> (); player2 = FindObjectOfType <Player2Movement> (); }
void Start() { anim = GetComponent <Animator> (); move = GetComponent <Player2Movement> (); fireTime = Time.time; arrowPower.value = 0; }
IEnumerator EndGame(int seconds) { yield return(new WaitForSeconds(seconds)); gObjects = GameObject.FindGameObjectsWithTag("Wall"); for (int i = 0; i < gObjects.Length; i++) { Destroy(gObjects [i]); } pObjects = GameObject.FindGameObjectsWithTag("Player"); for (int i = 0; i < pObjects.Length; i++) { Destroy(pObjects [i]); } GameObject PlayerOne = GameObject.Find("Player1"); Player1Movement script1 = PlayerOne.GetComponent <Player1Movement> (); GameObject PlayerTwo = GameObject.Find("Player2"); Player2Movement script2 = PlayerTwo.GetComponent <Player2Movement> (); score1 = script1.score; score2 = script2.score; if (score1 > score2) { EndMessage.text = "Player One won the game by " + (score1 - score2).ToString() + " points!"; } if (score2 > score1) { EndMessage.text = "Player Two won the game by " + (score2 - score1).ToString() + " points!"; } }
public void StopPlayers() { foreach (GameObject player in players) { if (player != null) { //This is for multiplayer because scripts are different name if (player.name == "Player") { PlayerMovement playerMovement = player.GetComponent <PlayerMovement>(); PlayerShooting playerShooting = player.GetComponentInChildren <PlayerShooting>(); //this is to stop walking animation playerMovement.AnimateWalk(0, 0); playerMovement.enabled = false; playerShooting.enabled = false; } else { Player2Movement player2Movement = player.GetComponent <Player2Movement>(); Player2Shooting player2Shooting = player.GetComponentInChildren <Player2Shooting>(); //this is to stop walking animation player2Movement.AnimateWalk(0, 0); player2Movement.enabled = false; player2Shooting.enabled = false; } } } }
// Use this for initialization void Start() { GameObject player1 = GameObject.FindGameObjectWithTag("Player1"); GameObject player2 = GameObject.FindGameObjectWithTag("Player2"); PlayerMovement p1play = player1.GetComponent <PlayerMovement>(); Player2Movement p2play = player2.GetComponent <Player2Movement> (); }
// Use this for initialization void Start() { //Set variables player1 = FindObjectOfType <Player1Movement> (); player2 = FindObjectOfType <Player2Movement> (); rigid1 = player1.GetComponent <Rigidbody> (); rigid2 = player2.GetComponent <Rigidbody> (); }
// Use this for initialization void Start() { //Finds the players Player1 = FindObjectOfType <Player1Movement> (); Player2 = FindObjectOfType <Player2Movement> (); rigid1 = Player1.GetComponent <Rigidbody> (); rigid2 = Player2.GetComponent <Rigidbody> (); }
void Start() { player = GameObject.FindGameObjectWithTag("player2").transform; orbita = GameObject.FindGameObjectWithTag("Orbit").transform; basePos = GameObject.FindGameObjectWithTag("Hand2").transform; pm = GameObject.FindGameObjectWithTag("player2").GetComponent <Player2Movement>(); esq = new Vector3(-0.13f, -0.13f, 0.13f); dir = new Vector3(0.13f, 0.13f, 0.13f); }
private void Start() { if (music.Instance) { fondo = music.Instance.gameObject.GetComponent <AudioSource>(); } P1 = FindObjectOfType <Player>(); P2 = FindObjectOfType <Player2Movement>(); }
// Use this for initialization void Start() { currentHealth = maxHealth; currentShieldHealth = maxShieldHealth; shieldSize = shield.transform.localScale; anim = GetComponent <Animator> (); rb = GetComponent <Rigidbody2D> (); move = GetComponent <Player2Movement> (); }
// Use this for initialization void Start() { //Set variables player1 = FindObjectOfType <Player1Movement> (); player2 = FindObjectOfType <Player2Movement> (); rigid1 = player1.GetComponent <Rigidbody> (); rigid2 = player2.GetComponent <Rigidbody> (); player1GameObject = player1.gameObject; player2GameObject = player2.gameObject; isThrowable = false; }
private void slowEnemy() { GameObject enemyObj = GameObject.FindGameObjectWithTag("Player2"); if (enemyObj != null) { enemy = enemyObj.GetComponent <Player2Movement>(); enemy.movementSpeed = 1.5f; StartCoroutine(debuffDuration()); } }
IEnumerator debuffDuration() { yield return(new WaitForSeconds(5.0f)); GameObject enemyObj = GameObject.FindGameObjectWithTag("Player2"); if (enemyObj != null) { enemy = enemyObj.GetComponent <Player2Movement>(); enemy.movementSpeed = 2.0f; } }
void Awake() { propManager = GetComponent <PropManager>(); player2Movement = FindObjectOfType <Player2Movement>(); firstSlicePosition = Vector3.forward * ((numberOfSlices - bufferedSlices) * sliceLength); for (int i = 1; i <= numberOfSlices; ++i) { InstantiateSlice(); } spawningObstacles = true; }
public void StopPlayersAndDie() { Animator playerAnim; AudioSource playerAudio; foreach (GameObject player in players) { if (player != null) { playerAnim = player.GetComponent <Animator>(); playerAudio = player.GetComponent <AudioSource>(); //This is for multiplayer because scripts are different name if (player.name == "Player") { PlayerMovement playerMovement = player.GetComponent <PlayerMovement>(); PlayerShooting playerShooting = player.GetComponentInChildren <PlayerShooting>(); playerMovement.enabled = false; playerShooting.enabled = false; } else { Player2Movement player2Movement = player.GetComponent <Player2Movement>(); Player2Shooting player2Shooting = player.GetComponentInChildren <Player2Shooting>(); player2Movement.enabled = false; player2Shooting.enabled = false; } if (!win) { playerAnim.SetTrigger("Die"); if (player.name == "Player") { playerAudio.clip = player.GetComponent <PlayerHealth>().deathClip; } else { playerAudio.clip = player.GetComponent <Player2Health>().deathClip; } playerAudio.Play(); } } } }
// Use this for initialization void Start() { GameObject player1 = GameObject.FindGameObjectWithTag("Player1"); GameObject player2 = GameObject.FindGameObjectWithTag("Player2"); PlayerMovement p1play = player1.GetComponent <PlayerMovement>(); Player2Movement p2play = player2.GetComponent <Player2Movement> (); redwins = redwins.GetComponent <Canvas> (); bluewins = bluewins.GetComponent <Canvas> (); redwins.enabled = false; bluewins.enabled = false; }
void Awake() { anim = GetComponent <Animator>(); playerAudio = GetComponent <AudioSource>(); //References the script movement and shooting playerMovement = GetComponent <Player2Movement>(); playerShooting = GetComponentInChildren <Player2Shooting>(); //Set current health to starting (100 by default) currentHealth = startingHealth; //Gets the animator's hud for die screen animation hudAnim = hud.GetComponent <Animator>(); }
void SetupGame() { _p1Movement = GameObject.Find(_PLAYER_1_NAME).GetComponent <Player1Movement>(); _p2Movement = GameObject.Find(_PLAYER_2_NAME).GetComponent <Player2Movement>(); _p1Shoot = GameObject.Find(_PLAYER_1_AIM).GetComponent <Player1Shoot>(); _p2Shoot = GameObject.Find(_PLAYER_2_AIM).GetComponent <Player2Shoot>(); _p1Health = GameObject.Find(_PLAYER_1_NAME).GetComponent <PlayerHealth>(); _p2Health = GameObject.Find(_PLAYER_2_NAME).GetComponent <PlayerHealth>(); state = BattleState.PLAYER1_TURN; Player1Turn(); }
private IEnumerator toggleShield(GameObject player) { if (player.tag == "Player") { PlayerMovement playerScript = player.GetComponent <PlayerMovement>(); yield return(new WaitForSeconds(0.1f)); playerScript.hasShield = false; } else if (player.tag == "Player2") { Player2Movement playerScript = player.GetComponent <Player2Movement>(); yield return(new WaitForSeconds(0.1f)); playerScript.hasShield = false; } }
public IntermediateBaloon(bool isPlayer1Baloon) { Speed = 5; Damage = 20; IsPlayer1Baloon = isPlayer1Baloon; type = Helpers.Enums.BaloonTypes.Intermediate; SpacingPoint = new PointF(70, 70); if (isPlayer1Baloon) { moveStrategy = new Player1Movement(); } else { moveStrategy = new Player2Movement(); Position.X = 675; } }
public WeakBaloon(bool isPlayer1Baloon) { Speed = 3; Damage = 1; IsPlayer1Baloon = isPlayer1Baloon; type = Helpers.Enums.BaloonTypes.Weak; SpacingPoint = new PointF(50, 50); if (isPlayer1Baloon) { moveStrategy = new Player1Movement(); } else { moveStrategy = new Player2Movement(); Position.X = 675; } }
public PowerfulBaloon(bool isPlayer1Baloon) { Speed = 7; Damage = 10; type = Helpers.Enums.BaloonTypes.Powerful; IsPlayer1Baloon = isPlayer1Baloon; SpacingPoint = new PointF(100, 100); if (isPlayer1Baloon) { moveStrategy = new Player1Movement(); } else { moveStrategy = new Player2Movement(); Position.X = 675; } }
// public GameObject explosion; void OnCollisionEnter2D(Collision2D other) { GameObject PlayerTwo = GameObject.Find("Player2"); Player2Movement script = PlayerTwo.GetComponent <Player2Movement> (); GameObject explode = (GameObject)Instantiate(Resources.Load("Explode"), gameObject.transform.position, gameObject.transform.rotation); GameObject explodingSound = (GameObject)Instantiate(Resources.Load("ExplodingSound"), gameObject.transform.position, gameObject.transform.rotation); Destroy(gameObject); Destroy(explode, 3f); Destroy(explodingSound, 3f); if (other.gameObject.tag == "Player") { script.score += 3; } if (other.gameObject.name.Contains("Enemy")) { Debug.Log("destroying enemy"); script.score += 1; } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Movement") { // increase speed for movement buff speed += 3.5f; Destroy(collision.gameObject); } else if (collision.gameObject.tag == "MovementDebuff") { // decrease speed for movement debuff speed -= 3.5f; Destroy(collision.gameObject); } else if (collision.gameObject.tag == "SelfStun") { // momentarily stop movement and ability to place bombs StartCoroutine(performSelfStun()); Destroy(collision.gameObject); } else if (collision.gameObject.tag == "ReverseMovement") { // momentarily reverse the direction of movement StartCoroutine(reversePlayerMovement()); Destroy(collision.gameObject); } else if (collision.gameObject.tag == "IncreaseBombs") { // increases the number of bombs that can be dropped at one time numBombs++; Destroy(collision.gameObject); } else if (collision.gameObject.tag == "Freeze") { // temporarily freeze the other player enemyPlayer = GameObject.FindGameObjectWithTag("Player2"); if (enemyPlayer != null) { enemySprite = enemyPlayer.GetComponent <Player2Movement>(); enemySprite.shouldFreeze = true; } Destroy(collision.gameObject); } else if (collision.gameObject.tag == "IncreaseRange") { bombRange++; Destroy(collision.gameObject); } else if (collision.gameObject.tag == "Shield") { hasShield = true; Destroy(collision.gameObject); } else if (collision.gameObject.tag == "ExplosionSpeed") { explosionDelay--; Destroy(collision.gameObject); } }
// Use this for initialization void Start() { player = GetComponentInParent <Player2Movement> (); }
void Awake() { //Cursor.lockState = CursorLockMode.Locked; p2Movement = GetComponent <Player2Movement>(); }
private void Start() { Player1 = FindObjectOfType <Player>(); Player2 = FindObjectOfType <Player2Movement>(); }
void Start() { thePlayer = FindObjectOfType <Player>();//NUEVO thePlayer2 = FindObjectOfType <Player2Movement>(); }