public void DrawLine(bool isFirstPlayerTurn, PlayerManagement playerManagement) { IsDrawn = true; if (IsHorizontal) { LineObject = Instantiate(LineObject, LineObjectsContainer.transform); } else { LineObject = Instantiate(LineObject, LineObjectsContainer.transform); } //Vector3 middlePoint = (StartPoint.Position + EndPoint.Position) / 2; Vector3 startPoint = StartPoint.Position; startPoint.z = 0; Vector3 endPoint = EndPoint.Position; endPoint.z = 0; LineObject.GetComponentInChildren <LineRenderer>().SetPositions(new Vector3[] { startPoint, endPoint }); if (isFirstPlayerTurn) { LineObject.GetComponentInChildren <LineRenderer>().GetComponentInChildren <Renderer>().material.SetColor("_EmissionColor", playerManagement.Player1.Color); } else { LineObject.GetComponentInChildren <LineRenderer>().GetComponentInChildren <Renderer>().material.SetColor("_EmissionColor", playerManagement.Player2.Color); } LineObject.GetComponentInChildren <Animator>().Play("LineFadeAndShow"); FindObjectOfType <AudioManager>().Play("draw_line"); }
// Use this for initialization void Start() { note = GetComponent <NoteObject> (); manager = GameObject.Find("NotesManagement").GetComponent <NotesManagement> (); player = GameObject.Find("PlayerManagement").GetComponent <PlayerManagement>(); hp = GameObject.Find("HP_BarCtrl").GetComponent <HP_BarCtrl>(); }
// Use this for initialization void Start() { PlayerShip = GameObject.Find("PlayerShip"); PlayerManagement = (PlayerManagement)PlayerShip.GetComponent(typeof(PlayerManagement)); EnemyMissile = GameObject.Find("EnemyMissile"); ShootEnemyMissileSound = (AudioSource)GameObject.Find("Sounds/ShootEnemyMissileSound").GetComponent(typeof(AudioSource)); DestroyedEnemySound = (AudioSource)GameObject.Find("Sounds/DestroyedEnemySound").GetComponent(typeof(AudioSource)); NextLevelReachedSound = (AudioSource)GameObject.Find("Sounds/NextLevelReachedSound").GetComponent(typeof(AudioSource)); xChange = Random.Range(-moveSpeed, moveSpeed); yChange = Random.Range(-moveSpeed, moveSpeed); Coin = GameObject.Find("Coin"); HpBooster = GameObject.Find("HpBooster"); if (PlayerPrefs.GetInt("OriginalEnemy") == 1) { PlayerPrefs.SetInt("OriginalEnemy", 0); silent = true; } StartCoroutine(CooldownTimer()); }
public void LoadScene(string sceneName) { PlayerManagement.resetLevel(); PlayerManagement.increaseLevel(); PlayerManagement.iniDeck(); SceneManager.LoadScene(sceneName); }
// Use this for initialization void Start() { spawnRocket = GetComponent <SpawnRocketAI>(); manager = GameObject.Find("_NetworkManager").GetComponent <NetworkManager>(); for (int i = 0; i < colliders.Length; i++) { for (int v = 0; v < colliders.Length; v++) { Physics.IgnoreCollision(colliders[i], colliders[v]); } } if (isServer) { playerManagement = GameObject.Find("LocalConnection").GetComponent <PlayerManagement>(); } else { //ERROR maybe? not sure if that will get the correct refrence. playerManagement = GameObject.Find("PlayerConnect(Clone)").GetComponent <PlayerManagement>(); } playerManagement.totalPlayers++; StartCoroutine(WaitForCheckDeath()); if (GetComponent <PlayerControl>()) { isPlayer = true; } }
void InitScripts() { engineS = enginePart.GetComponent <engineController> (); gunS = gunPart.GetComponent <coreGunController> (); jetS = jetPart.GetComponent <jetController> (); enemymovement = GetComponent <EnemyMovement> (); playerManager = player.GetComponent <PlayerManagement> (); }
private void Start() { PlayerManagement playerManager = GetComponent <PlayerManagement>(); playerAnimator = GetComponent <Animator>(); player = playerManager.player; role = playerManager.role; }
// Use this for initialization void Start() { playerMgr = FindObjectOfType <PlayerManagement>(); if (playerMgr != null) { playerMgr.SpawnPlayers(); } }
void Awake() { health = maxHealth; // TODO: Find a better place to do this if (gameObject.tag == "Player" || gameObject.tag == "Player Interaction Collider") { PlayerManagement.AddPlayer(gameObject.transform.gameObject); } }
void Start() { PlayerManagement playerManager = GetComponent <PlayerManagement>(); playerAnimator = GetComponent <Animator>(); player = playerManager.player; role = playerManager.role; player.state.OnComboEvent += HandleComboEvent; player.state.OnDirectionFlipped += HandleDirectionFlipped; }
private void Awake() { if (!PhotonNetwork.connected) { SceneManager.LoadScene(0); } Instance = this; PhotonView = GetComponent <PhotonView>(); _playerNameLabel.text = PhotonNetwork.playerName; }
public void Die() { // game over // block both players from taking new moves //Debug.Log("Player is " + gameObject.name); if (gameObject.name != "Player1 - LOW") { new ShowMessageCommand("You win!", 2.0f).AddToQueue(); IDFactory.ResetIDs(); IDHolder.ClearIDHoldersList(); Command.CommandQueue.Clear(); Command.CommandExecutionComplete(); if (PlayerManagement.getLevel() == 7) { SceneManager.LoadScene("Ending"); } else if (PlayerManagement.getLevel() == 6) { PlayerManagement.increaseLevel(); SceneManager.LoadScene("BattleScene7"); } else if (PlayerManagement.getLevel() == 5) { PlayerManagement.increaseLevel(); SceneManager.LoadScene("BattleScene6"); } else if (PlayerManagement.getLevel() == 4) { PlayerManagement.increaseLevel(); SceneManager.LoadScene("BattleScene5"); } else if (PlayerManagement.getLevel() == 3) { PlayerManagement.increaseLevel(); SceneManager.LoadScene("BattleScene4"); } else if (PlayerManagement.getLevel() == 2) { PlayerManagement.increaseLevel(); SceneManager.LoadScene("BattleScene3"); } else if (PlayerManagement.getLevel() == 1) { PlayerManagement.increaseLevel(); SceneManager.LoadScene("BattleScene2"); } //SceneManager.LoadScene("Ending"); return; } PArea.ControlsON = false; otherPlayer.PArea.ControlsON = false; TurnManager.Instance.StopTheTimer(); new GameOverCommand(this).AddToQueue(); }
void Awake() { if (Instance == null) { DontDestroyOnLoad(this.gameObject); Instance = this; } else if (Instance != this) { Destroy(gameObject); } }
void Awake() { // if the singleton hasn't been initialized yet if (Instance != null && Instance != this) { Destroy(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); playerManagement = new PlayerManagement(); // loadingScreenControl = LoadingScreenControl.Instance; }
private void SpawnWhite() { if (currentState != BehaviourState.INIT || currentState != BehaviourState.DIE) { if (!isWhiteEquipped && PlayerManagement.GetInstance().GetCurrentState() == GameManagement.GameState.PLAY) { whiteSpawnElapsedTime += Time.fixedDeltaTime; if (whiteSpawnElapsedTime > PLAYER_WHITE_SPAWN_TIME) { isWhiteEquipped = true; UIManagement.GetInstance().GetGameSceneBG_white().SetActive(true); whiteSpawnElapsedTime = 0; } } } }
//Initialize Method of this class private void Init() { prefab_walls = Resources.Load("Prefabs/Walls") as GameObject; prefab_background = Resources.Load("Prefabs/Background") as GameObject; currentState = GameState.INIT; previousState = GameState.NULL; stageManagement = StageManagement.GetInstance(); playerManagement = PlayerManagement.GetInstance(); enemyManagement = EnemyManagement.GetInstance(); uiManagment = UIManagement.GetInstance(); itemManagement = ItemManagement.GetInstance(); scoreManagement = ScoreManagement.GetInstance(); soundManagement = SoundManagement.GetInstance(); StartCoroutine(CheckState()); }
// ALL METHODS void Awake() { // find all scripts of type Player and store them in Players array // (we should have only 2 players in the scene) Players = GameObject.FindObjectsOfType <Player>(); // obtain unique id from IDFactory PlayerID = IDFactory.GetUniqueID(); //Debug.Log(PArea.owner); PlayerManagement.iniDeck(); if (PArea.owner == AreaPosition.Low) { deck.cards = PlayerManagement.getCard(); } //Debug.Log(deck.cards.Count); }
public void DrawBox(bool isFirstPlayerTurn, PlayerManagement playerManagement) { BoxObject = Instantiate(BoxObject, BoxObjectsContainer.transform); BoxObject.GetComponent <Transform>().position = Position; IsDrawn = true; if (isFirstPlayerTurn) { BoxObject.GetComponentInChildren <Renderer>().material.SetColor("_EmissionColor", playerManagement.Player1.Color); } else { BoxObject.GetComponentInChildren <Renderer>().material.SetColor("_EmissionColor", playerManagement.Player2.Color); } FindObjectOfType <AudioManager>().Play("draw_box"); BoxObject.GetComponentInChildren <Animator>().Play("BoxAnimation"); }
protected void FixedUpdate() { if (nearestPlayer == null) { nearestPlayer = PlayerManagement.GetNearestPlayer(transform.position); if (nearestPlayer == null) { Debug.LogWarning(gameObject.name + " could not find a player!"); return; } } else { distanceToPlayer = Vector2.Distance(nearestPlayer.transform.position, transform.position); inRangeToAttack = distanceToPlayer < attackRange; isPlayerDetected = distanceToPlayer < enemyDetectionDistanceCurrent; } }
private void StartGameScene() { numPlayers = SyncData.numPlayers; if (!isLocalPlayer && isServer) { playerManagement = GameObject.Find("LocalConnection").GetComponent <PlayerManagement>(); } if (isServer && isLocalPlayer) { server = true; } if (server) { GameObject.Find("PlayersLeft").transform.GetChild(0).gameObject.GetComponent <PlayersLeft>().playerManagement = this; } if (isLocalPlayer) { CmdSpawn(); //Spawn code here if (isServer) { if (!SyncData.isCampaign) { SyncData.gameMode = ChooseGamemode(); } else { for (int i = 0; i < numPlayers; i++) { CmdBotSpawn(); } } /*else if (SyncData.gameMode == 2) * { * StartCoroutine(Onslaught()); * }*/ } } StartCoroutine(GameModeUpdate()); }
void Start() { Debug.Log(PlayerPrefs.HasKey(STotalPointInEachSide)); TotalPointInEachSide = PlayerPrefs.GetInt(GetComponent <Constants>().TOTALPOINTS, 6); Debug.Log(TotalPointInEachSide.ToString()); PointDistance = (10 * 1.0f) / ((TotalPointInEachSide * 1.0f) - 1); GlobalBoxObject.GetComponent <Transform>().localScale = new Vector3(PointDistance - 1, PointDistance - 1); PlayerManagement = gameObject.GetComponent <PlayerManagement>(); PlayerManagement.SetPlayers(IsPlayingWithMobile); difficultyLevel = PlayerPrefs.GetString(GetComponent <Constants>().MOBILEGAMEMODE, GetComponent <Constants>().MOBILEGAMEMODEEASY); TotalPoints = TotalPointInEachSide * TotalPointInEachSide; TotalLines = (TotalPointInEachSide * (TotalPointInEachSide - 1)) * 2; TotalBox = (TotalPointInEachSide - 1) * (TotalPointInEachSide - 1); DrawPoints(); DrawLines(); DrawBoxes(); }
void Awake() { Assert.IsNull(main); main = this; PlayerManagement.BuildPlayer(); }
// Use this for initialization void Start() { this.characterController = this.GetComponent<CharacterController>(); this.verticalRotation = 0.0f; this.mouseSensitivity = (this.mouseSensitivity <= 0.0f) ? 5.0f : this.mouseSensitivity; this.movementSpeed = (this.movementSpeed <= 0.0f) ? 10.0f : this.movementSpeed; this.verticalViewAngle = (this.verticalViewAngle <= 0.0f) ? 120.0f : this.verticalViewAngle; //Cursor.lockState = CursorLockMode.Locked; //Cursor.visible = false; this.playerManagement = GetComponent<PlayerManagement> (); this.mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); }
// Use this for initialization void Start() { PlayerShip = GameObject.Find("PlayerShip"); PlayerManagement = (PlayerManagement)PlayerShip.GetComponent(typeof(PlayerManagement)); }
private void Awake() { playerManagement = PlayerManagement.GetComponent <PlayerManagement>(); }
// Use this for initialization void Start() { // Countdown this.startTime = MAX_TIME; this.isTimerActive = false; this.countDown.text = ""; this.activeColor = new Color32(22,255,123,255); Color tempEndGame = this.endGame.color; tempEndGame.a = 0; this.endGame.color = tempEndGame; float x = Screen.width-(this.minimap.rectTransform.sizeDelta.x/2); float y = this.minimap.rectTransform.sizeDelta.y/2; this.minimap.transform.position = new Vector3(x,y,0); this.minimapplayer.transform.position = new Vector3 (Screen.width-33,353,0); this.health = 100; this.maxHealth = 100; this.playerManagement = GetComponent<PlayerManagement> (); }
public BulletFireCommand(PlayerManagement pm, Vector3 spawnPosition, Vector3 fireDirection) { owner = pm; position = spawnPosition; direction = fireDirection; }
private void Awake() { instance = this; photonView = GetComponent <PhotonView>(); }
public void SetOwner(PlayerManagement pm) { owner = pm; Physics.IgnoreCollision(pm.GetComponent <Collider>(), GetComponent <Collider>()); }
private void Start() { playerPosition = PlayerManagement.GetNearestPlayer(transform.position).transform; }
// Use this for initialization void Awake() { Instance = this; PhotonView = GetComponent <PhotonView>(); }
private void Awake() { instance = this; }