/// <summary> /// Removes opponentController from opponents on this point /// </summary> /// <param name="opponent">Opponent leaving this tile</param> public void LeaveFromThisPoint(OpponentController opponent) { if (opponentsOnThisPoint.Contains(opponent)) { opponentsOnThisPoint.Remove(opponent); } }
public void Init(TokenManager tokenManager, DiceManager diceManager, OpponentController oppCtrl, BoardHighlighter highlighter) { this.diceManager = diceManager; this.opponentCtrl = oppCtrl; this.highlighter = highlighter; this.tokenManager = tokenManager; opponentCtrl.onTokenSelected += TokenSelected; opponentCtrl.TokenManager = tokenManager; diceManager.onDiceRolled += DiceRolled; dice = diceManager.GetCurrentActiveDice(); tokenManager.onTokenAnimationsDone += TokenAnimationsEnd; selectedTypes = new Token.TokenType[tokenManager.Tokens.Keys.Count]; tokenManager.Tokens.Keys.CopyTo(selectedTypes, 0); foreach (KeyValuePair <Token.TokenType, Token[]> entry in tokenManager.Tokens) { for (int i = 0; i < entry.Value.Length; i++) { Token t = entry.Value[i].GetComponent <Token> (); t.onTokenSelected += TokenSelected; } } }
void Start() { Physics.IgnoreCollision(this.GetComponent <MeshCollider>(), GameObject.Find("NeutralZone").GetComponent <BoxCollider>()); player1 = player1obj.GetComponent <PaddleController> (); player2 = player2obj.GetComponent <OpponentController> (); currZPos = transform.position.z; lastZPos = transform.position.z; }
public void UpdateReceived(string senderId, float rotZ, float posY) { OpponentController opponent = _opponentScripts[senderId]; if (opponent != null) { opponent.SetCarInformation(rotZ, posY); } }
// Use this for initialization void Start() { //RetrieveRoute(); instance = this; foreach (FollowPath fp in UnitsModels) { fp.gameObject.SetActive(false); } }
public void Initialize(BulletConfig config, OpponentController opponent, int damage) { opponent.OnDead += OnEnemyDead; this.transform.position = new Vector3(transform.position.x, transform.position.y + 1f, transform.position.z); this.opponent = opponent; this.enemyName = opponent.name; this.damage = damage; speed = config.speed; isAlive = true; }
void SetupMultiplayerGame() { MultiplayerController.Instance.updateListener = this; // TODO: Fill this out! // 1 _myParticipantId = MultiplayerController.Instance.GetMyParticipantId(); // 2 List <Participant> allPlayers = MultiplayerController.Instance.GetAllPlayers(); _opponentScripts = new Dictionary <string, OpponentController>(allPlayers.Count - 1); for (int i = 0; i < allPlayers.Count; i++) { string nextParticipantId = allPlayers[i].ParticipantId; Debug.Log("Setting up car for " + nextParticipantId); // 3 Vector3 carStartPoint = Vector3.zero; if (nextParticipantId == _myParticipantId) { // 4 carStartPoint = new Vector3(_startingPoint.x, _startingPoint.y, 0); myCar = (Instantiate(myCarPrefab, carStartPoint, Quaternion.identity) as GameObject); myCar.GetComponent <PlayerController>().SetCarChoice(i + 1, true); myCar.GetComponent <PlayerController>().SetMyTurn(i); //myCar.transform.position = carStartPoint; } else { if (i == 1) { GameObject Planets = GameObject.Find("Planets"); foreach (Transform planet in Planets.transform) { planet.position = new Vector3(-planet.position.x, planet.position.y, planet.position.z); planet.rotation = Quaternion.Euler(new Vector3(0, 180f, 0)); } } //Mirror Planets // 5 carStartPoint = new Vector3(_startingPoint.x * -1, _startingPoint.y, 0); opponentCar = (Instantiate(opponentPrefab, carStartPoint, Quaternion.Euler(0, 0, -180f)) as GameObject); OpponentController opponentScript = opponentCar.GetComponent <OpponentController>(); opponentScript.SetCarNumber(i + 1); // 6 _opponentScripts[nextParticipantId] = opponentScript; } } // 7 //_lapsRemaining = 3; //_timePlayed = 0; //guiObject.SetLaps(_lapsRemaining); //guiObject.SetTime(_timePlayed); //_multiplayerReady = true; }
// Start is called before the first frame update void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
void Start() { DefineCurrentLevel(); if (currentLevel == 0 && PlayerPrefs.GetInt("Tutorial") == 0) { StartTutorial(); PlayerPrefs.SetInt("Tutorial", 1); return; } opponent = FindObjectOfType <OpponentController>(); player = FindObjectOfType <PlayerController>(); ChangeTechniqueButtonsDependingOnCurrentLevel(); StartCoroutine(StartCounting()); StartCoroutine(ActivateOpponents()); }
void Start() { GameMaster gm = GameMaster.instance; DiceManager diceManager = GetComponent <DiceManager> (); TokenManager tokenManager = GetComponent <TokenManager> (); TurnManager turnManager = GetComponent <TurnManager> (); WaypointManager waypointManager = GetComponent <WaypointManager> (); HomeBaseManager hbManager = GetComponent <HomeBaseManager> (); OpponentController opponentCtrl = GetComponent <OpponentController> (); BoardHighlighter highlighter = GameObject.Find("Board").GetComponent <BoardHighlighter> (); diceManager.Init(gm.SelectedTokens); opponentCtrl.DiceManager = diceManager; tokenManager.Init(waypointManager, hbManager, gm.SelectedTokens, gm.SelectedTokenPlayers); turnManager.Init(tokenManager, diceManager, opponentCtrl, highlighter); turnManager.StartFirstTurn(); }
// Use this for initialization void Start() { player1Score = 0; player2Score = 0; winScore = 5; hud = GameObject.Find("GUICanvas").GetComponent <HUD>(); playerStartPos = GameObject.Find("PlayerStartPos"); enemyStartPos = GameObject.Find("EnemyStartPos"); playerPuckStart = GameObject.Find("PlayerPuckStart"); enemyPuckStart = GameObject.Find("EnemyPuckStart"); puck = GameObject.Instantiate(puckPrefab); player = GameObject.Instantiate(playerPrefab).GetComponent <PaddleController>(); enemy = GameObject.Instantiate(enemyPrefab).GetComponent <OpponentController>(); puck.GetComponent <Puck> ().player1obj = player.gameObject; puck.GetComponent <Puck> ().player2obj = enemy.gameObject; ResetPositions(true); }
/** * <summary>Triggers the end game menu when the player exits the maze.</summary> * <param name="other">The collision of the player with the end game object.</param> */ void OnTriggerEnter2D(Collider2D other) { // Freeze the character GameObject ruby = GameObject.Find("Ruby"); Rigidbody2D rubyRigidbody = ruby.GetComponent <Rigidbody2D>(); rubyRigidbody.constraints = RigidbodyConstraints2D.FreezeAll; if (MainScript.UseShooter) { ruby.GetComponent <RubyFireAim>().DisableShooting(); } // Set the end game variable to true PlayersTime = timer; if (!EndBattleGameMenu.OpponentFinished) { OpponentController opponent = GameObject.Find("Opponent").GetComponent <OpponentController>(); opponent.CalculateOpponentValues(); } timerIsRunning = false; EndBattleGameMenu.PlayerFinished = true; }
public virtual void Start() { _tokenTypes = Resources.LoadAll("ChessPieces/"); gridArray = new GameObject[gridWidth, gridHeight]; MakeGrid(); if (playerColor == ChessPiece.PieceColor.Black) { opponentColor = ChessPiece.PieceColor.White; } else { opponentColor = ChessPiece.PieceColor.Black; } matchManager = GetComponent <MatchManagerScript>(); inputManager = GetComponent <InputManagerScript>(); repopulateManager = GetComponent <RepopulateScript>(); moveTokenManager = GetComponent <MoveTokensScript>(); opponentController = GetComponent <OpponentController>(); }
public void SetupSP(GameObject playerGameObject) { instance = playerGameObject; //Get references to the components for player switch(playerNumber) { case 0: //player playerSetupSP = instance.GetComponent<PlayerSetupSP>(); playerControlSP = instance.GetComponent<PlayerControlSP>(); playerCameraSP = instance.GetComponent<PlayerCameraSP>(); playerSetupSP.colorIndex = playerColorIndex; playerSetupSP.playerName = playerName; playerSetupSP.playerNumber = playerNumber; playerSetupSP.randomTerrainSeed = randomTerrainSeed; break; case 1: //computer opponent opponentController = instance.GetComponent<OpponentController>(); break; } }
void Start() { HP = 5; FG_HP = Resources.Load <Texture2D>("Sprites/UI/Level_FG"); BG_HP = Resources.Load <Texture2D>("Sprites/UI/Level_BG"); _menu = GetComponent <Menu>(); ID = GameObject.Find("ItemDatabase").GetComponent <ItemDatabase>(); skin = Resources.Load <GUISkin>("Sprites/UI/New GUISkin"); PlayerMove = Question = true; width = Screen.width / 20; UIBorders = Camera.main.WorldToScreenPoint(transform.position); WidthBorder = Screen.width / 10; YY = Screen.height / 10; Smiles = new Texture2D[2]; for (int i = 0; i < Smiles.Length; i++) { Smiles[i] = Resources.Load <Texture2D>("Sprites/UI/Smile_" + i); } JINT = new int[20]; if (name == "Player") { GameObject pers = Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/Pers/Pers_" + PlayerPrefs.GetInt("DateLevel"))); pers.name = "Pers_" + PlayerPrefs.GetInt("DateLevel"); } OppC = GameObject.Find("Pers_" + PlayerPrefs.GetInt("DateLevel")).GetComponent <OpponentController>(); OppC.name = "Pers_" + PlayerPrefs.GetInt("DateLevel"); MainChoise = new Texture2D[5]; SecondChoise = new Texture2D[3]; for (int i = 0; i < 5; i++) { MainChoise[i] = Resources.Load <Texture2D>("Sprites/UI/MainChoise" + i); } ChoiseT = Resources.Load <Texture2D>("Sprites/UI/Choise"); LOVET = Resources.Load <Texture2D>("Sprites/UI/Love"); X_max = 4; Y_max = MainChoise.Length; ScreenBorder = new Vector2(Screen.width / 10, Screen.height / 10); anim = GetComponent <Animator>(); AU = GetComponent <AudioSource>(); Clicks = new AudioClip[3]; for (int i = 0; i < Clicks.Length; i++) { Clicks[i] = Resources.Load <AudioClip>("Sound/UI/Click_" + i); } EnterClips = new AudioClip[3]; for (int i = 0; i < EnterClips.Length; i++) { EnterClips[i] = Resources.Load <AudioClip>("Sound/UI/Enter_" + i); } }
void Start() { gameController = GameObject.Find("Game Controller").GetComponent <GameController>(); opponentController = GameObject.FindGameObjectWithTag("Opponent").GetComponent <OpponentController>(); }