Example #1
0
        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");
        }
Example #2
0
 // 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>();
 }
Example #3
0
    // 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);
 }
Example #5
0
 // 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;
     }
 }
Example #6
0
 void InitScripts()
 {
     engineS       = enginePart.GetComponent <engineController> ();
     gunS          = gunPart.GetComponent <coreGunController> ();
     jetS          = jetPart.GetComponent <jetController> ();
     enemymovement = GetComponent <EnemyMovement> ();
     playerManager = player.GetComponent <PlayerManagement> ();
 }
Example #7
0
    private void Start()
    {
        PlayerManagement playerManager = GetComponent <PlayerManagement>();

        playerAnimator = GetComponent <Animator>();
        player         = playerManager.player;
        role           = playerManager.role;
    }
Example #8
0
 // 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);
        }
    }
Example #10
0
    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;
    }
Example #12
0
 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);
     }
 }
Example #14
0
    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;
    }
Example #15
0
 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;
             }
         }
     }
 }
Example #16
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());
    }
Example #17
0
    // 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);
    }
Example #18
0
        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");
        }
Example #19
0
    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());
    }
Example #21
0
    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();
    }
Example #22
0
 void Awake()
 {
     Assert.IsNull(main);
     main = this;
     PlayerManagement.BuildPlayer();
 }
Example #23
0
    // 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");
    }
Example #24
0
 // Use this for initialization
 void Start()
 {
     PlayerShip       = GameObject.Find("PlayerShip");
     PlayerManagement = (PlayerManagement)PlayerShip.GetComponent(typeof(PlayerManagement));
 }
Example #25
0
 private void Awake()
 {
     playerManagement = PlayerManagement.GetComponent <PlayerManagement>();
 }
Example #26
0
    // 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> ();
    }
Example #27
0
 public BulletFireCommand(PlayerManagement pm, Vector3 spawnPosition, Vector3 fireDirection)
 {
     owner     = pm;
     position  = spawnPosition;
     direction = fireDirection;
 }
 private void Awake()
 {
     instance   = this;
     photonView = GetComponent <PhotonView>();
 }
Example #29
0
 public void SetOwner(PlayerManagement pm)
 {
     owner = pm;
     Physics.IgnoreCollision(pm.GetComponent <Collider>(), GetComponent <Collider>());
 }
 private void Start()
 {
     playerPosition = PlayerManagement.GetNearestPlayer(transform.position).transform;
 }
Example #31
0
 // Use this for initialization
 void Awake()
 {
     Instance   = this;
     PhotonView = GetComponent <PhotonView>();
 }
Example #32
0
 private void Awake()
 {
     instance = this;
 }