Exemplo n.º 1
0
    public GameObject PlaceNextCube(RaycastHit hit, GameManager.PlayerColor color)
    {
        Vector3 positionInGrid = GridManager.instance.GetPositionInGrid(transform.localPosition);

        bool canPlace = true;

        if (Mathf.RoundToInt(positionInGrid.x) < 0 || Mathf.RoundToInt(positionInGrid.x) >= GridManager.instance.Dimension)
        {
            canPlace = false;
        }
        else if (Mathf.RoundToInt(positionInGrid.y) < 0 || Mathf.RoundToInt(positionInGrid.y) >= GridManager.instance.Dimension)
        {
            canPlace = false;
        }
        else if (Mathf.RoundToInt(positionInGrid.z) < 0 || Mathf.RoundToInt(positionInGrid.z) >= GridManager.instance.Dimension)
        {
            canPlace = false;
        }

        if (canPlace == false)
        {
            return(null);
        }

        GameObject nextCube;

        nextCube = Instantiate(CubePrefab, transform.position, transform.rotation);
        nextCube.transform.parent = transform.parent;
        nextCube.GetComponent <CubeController>().SetCubeColor(color);
        nextCube.GetComponent <CubeController>().PlaceCube(positionInGrid);

        nextCube.GetComponent <CubeController>().SetGlow(GameManager.instance.gridManager.GlowValue);

        return(nextCube);
    }
Exemplo n.º 2
0
    public void ShowReady()
    {
        CanvasInGame.enabled       = false;
        CanvasIntermission.enabled = true;
        CanvasGameOver.enabled     = false;

        GameManager.PlayerColor color = GameManager.instance.GetPlayerColor(GameManager.instance.GetCurrentPlayer());
        Color playerColorYOOO         = new Color(1f, 0f, 0.3f, 1);

        if (color == GameManager.PlayerColor.eColorOne)
        {
            playerColorYOOO = new Color(1f, 0f, 0.3f, 1);
        }
        else if (color == GameManager.PlayerColor.eColorTwo)
        {
            playerColorYOOO = new Color(0.16f, 0.67f, 1f, 1);
        }
        else if (color == GameManager.PlayerColor.eColorThree)
        {
            playerColorYOOO = new Color(0f, 0.89f, 0.21f, 1);
        }
        else if (color == GameManager.PlayerColor.eColorFour)
        {
            playerColorYOOO = new Color(1f, 0.93f, 0.15f, 1);
        }

        buttonReady.GetComponent <Image>().color = playerColorYOOO;
        TimerText.color = playerColorYOOO;
        GameManager.instance.StopPlay();
    }
Exemplo n.º 3
0
    private void CheckContact(GameObject otherGameObject)
    {
        if (pickUP.fillAmount < 1f)
        {
            return;
        }

        ShipColor shipColor = otherGameObject.GetComponent <ShipColor>();

        if (shipColor != null)
        {
            string sfxName = string.Format("PointCollect{0}", pickUpTier);
            AudioManager._AUDIOMANAGER.playSound(sfxName);

            ShipGridManager shipGridManager = otherGameObject.GetComponent <ShipGridManager>();
            if (shipGridManager != null)
            {
                shipGridManager.colorWake.m_VectorGrid.AddGridForce(otherGameObject.transform.position, collectionForce, collectionRadius, shipGridManager.colorWake.m_Color, true);
            }

            GameManager.PlayerColor collectorColor = GameManager._GAMEMANAGER.GetPlayerColor(shipColor.playerNumber);
            GameManager._GAMEMANAGER.ScorePoints(collectorColor, value);

            Destroy(gameObject);
        }
    }
    public void SetCubeColor(GameManager.PlayerColor color)
    {
        cubeColor = color;

        Material[] mats;
        mats = GetComponent <Renderer>().materials;

        if (color == GameManager.PlayerColor.eColorOne)
        {
            mats[1] = GameManager.instance.MaterialsPlayersGalaxies[0];
            mats[5] = GameManager.instance.MaterialsPlayers[0];
            GetComponent <Renderer>().materials = mats;
        }
        else if (color == GameManager.PlayerColor.eColorTwo)
        {
            mats[1] = GameManager.instance.MaterialsPlayersGalaxies[1];
            mats[5] = GameManager.instance.MaterialsPlayers[1];
            GetComponent <Renderer>().materials = mats;
        }
        else if (color == GameManager.PlayerColor.eColorThree)
        {
            mats[1] = GameManager.instance.MaterialsPlayersGalaxies[2];
            mats[5] = GameManager.instance.MaterialsPlayers[2];
            GetComponent <Renderer>().materials = mats;
        }
        else if (color == GameManager.PlayerColor.eColorFour)
        {
            mats[1] = GameManager.instance.MaterialsPlayersGalaxies[3];
            mats[5] = GameManager.instance.MaterialsPlayers[3];
            GetComponent <Renderer>().materials = mats;
        }
    }
    public GameObject PlaceNextCube(RaycastHit hit, GameManager.PlayerColor color)
    {
        Vector3 positionInGrid = GridManager.instance.GetPositionInGrid(transform.parent.InverseTransformPoint(transform.position + hit.normal * GridManager.instance.SizeCube));

        bool canPlace = true;

        if (Mathf.RoundToInt(positionInGrid.x) < 0 || Mathf.RoundToInt(positionInGrid.x) >= GridManager.instance.Dimension)
        {
            canPlace = false;
        }
        else if (Mathf.RoundToInt(positionInGrid.y) < 0 || Mathf.RoundToInt(positionInGrid.y) >= GridManager.instance.Dimension)
        {
            canPlace = false;
        }
        else if (Mathf.RoundToInt(positionInGrid.z) < 0 || Mathf.RoundToInt(positionInGrid.z) >= GridManager.instance.Dimension)
        {
            canPlace = false;
        }

        bool isCurrentCube = false;

        foreach (CubeController obj in GameManager.instance.currentBlocksPlaced)
        {
            if (obj == this)
            {
                isCurrentCube = true;
            }
        }

        if (GameManager.instance.onlyLastCube && this != GameManager.instance.lastCubes[GameManager.instance.GetCurrentPlayer()])
        {
            canPlace = false;
        }
        else if (GameManager.instance.lastCubes[GameManager.instance.GetCurrentPlayer()] != null && isCurrentCube == false)
        {
            canPlace = false;
        }

        if (canPlace == false)
        {
            return(null);
        }

        if (GameManager.instance.lastCubes[GameManager.instance.GetCurrentPlayer()] == null)
        {
            GameManager.instance.StopGlow();
        }

        GameObject nextCube;

        nextCube = Instantiate(CubePrefab, transform.position + hit.normal * GridManager.instance.SizeCube, transform.rotation);
        nextCube.transform.parent = transform.parent;
        nextCube.GetComponent <CubeController>().SetCubeColor(color);
        nextCube.GetComponent <CubeController>().PlaceCube(positionInGrid);

        nextCube.GetComponent <CubeController>().SetGlow(GameManager.instance.gridManager.GlowValue);

        return(nextCube);
    }
Exemplo n.º 6
0
    bool CheckColorChanged(int playerNumber, out GameManager.PlayerColor newPlayerColor)
    {
        newPlayerColor = GetInputPlayerColor(playerNumber);

        if ((newPlayerColor != GameManager.PlayerColor.Dead) && (newPlayerColor != GameManager._GAMEMANAGER.GetPlayerColor(playerNumber)))
        {
            return(true);
        }

        return(false);
    }
Exemplo n.º 7
0
    /// <summary>
    /// OnTriggerEnter is called when the Collider other enters the trigger.
    /// </summary>
    /// <param name="other">The other Collider involved in this collision.</param>
    void OnTriggerEnter(Collider other)
    {
        if (playerColor == GameManager.PlayerColor.Dead)
        {
            // The color hasn't been set, so not a valid collision.
            return;
        }

        ShipColor shipColor = other.gameObject.GetComponent <ShipColor>();

        if (shipColor != null)
        {
            GameManager.PlayerColor shipPlayerColor = GameManager._GAMEMANAGER.GetPlayerColor(shipColor.playerNumber);
            if ((shipPlayerColor != playerColor) && (shipColor.playerNumber != playerNumber))
            {
                GameManager._GAMEMANAGER.KillPlayer(other.gameObject);
                GameManager._GAMEMANAGER.ScorePoints(playerColor, GameManager._GAMEMANAGER.wakeKillAwardPoints);
                Debug.Log(string.Format("Player {0} {1} wake killed player {2} {3}", playerNumber, playerColor, shipColor.playerNumber, shipPlayerColor));
                Destroy(gameObject);
            }
        }
    }
Exemplo n.º 8
0
    public void UpdateColor(int player, GameManager.PlayerColor color)
    {
        Color[] temp = white;
        switch (color)
        {
        case GameManager.PlayerColor.Red:
            temp = red;
            break;

        case GameManager.PlayerColor.Green:
            temp = green;
            break;

        case GameManager.PlayerColor.Blue:
            temp = blue;
            break;

        case GameManager.PlayerColor.Yellow:
            temp = yellow;
            break;
        }
        corners [player - 1].SwitchColor(temp);
    }
Exemplo n.º 9
0
 public Score(int score, GameManager.PlayerColor playerName, Color myColor)
 {
     this.score       = score;
     this.playerName  = playerName;
     this.playerColor = myColor;
 }