Beispiel #1
0
    public void StartLerpToCircle(int playerOrder)
    {
        // Assign from lists
        LevelManager.innerLerpFrom = pointManager.SpawnCircleLerpPoints(PlayerManager.players[playerOrder].points, LevelManager.innerPoints, _inGameManager.levelCenter, circleEdges);
        LevelManager.outerLerpFrom = LevelManager.innerLerpFrom.GetRange(LevelManager.innerLerpFrom.Count / 2, LevelManager.innerLerpFrom.Count / 2);
        LevelManager.innerLerpFrom.RemoveRange(LevelManager.innerLerpFrom.Count / 2, LevelManager.innerLerpFrom.Count / 2);

        Vector2 avgVector    = ((PlayerManager.players[playerOrder].points.left - _inGameManager.levelCenter) + (PlayerManager.players[playerOrder].points.right - _inGameManager.levelCenter)) / 2;
        float   rotateAmount = avgVector.y < 0 ? 360 - Mathf.Acos(avgVector.normalized.x) * Mathf.Rad2Deg : Mathf.Acos(avgVector.normalized.x) * Mathf.Rad2Deg;

        // Assign to lists
        LevelManager.innerLerpTo = pointManager.SpawnInnerPoints(circleEdges * 2, _inGameManager.levelCenter);
        pointManager.RotatePoints(LevelManager.innerLerpTo, rotateAmount);
        LevelManager.outerLerpTo = pointManager.SpawnOuterPoints(LevelManager.innerLerpTo);

        //meshManager.SetMaterials();

        playerManager.CircleSetPlayerPoints(LevelManager.innerLerpTo, playerOrder);
        _gameManager.StartCountdown(_inGameManager.levelCenter);
    }
Beispiel #2
0
    public void UpdatePsychadelicLevel(float sinRotMagnitude, float[] weightedRadians, float magnitude, float angle)
    {
        innerPoints = pointManager.SpawnInnerPoints(innerPoints.Count, levelCenter, weightedRadians);
        pointManager.RotatePoints(innerPoints, -Mathf.Sin(angle) * magnitude * sinRotMagnitude + previousRotation);
        outerPoints = pointManager.SpawnOuterPoints(innerPoints);

        playerManager.UpdatePlayerPositions();
        playerManager.PlayersLookAtPoint(levelCenter);
        arqdutManager.UpdateArqdutPositions(innerPoints, levelCenter);

        DrawMesh(innerPoints.Count);
    }
Beispiel #3
0
    /// <summary>
    /// Calls all methods necessary for spawning the initial level
    /// </summary>
    public void SpawnLevel(int corners)
    {
        LevelManager.innerPoints = pointManager.SpawnInnerPoints(corners, _inGameManager.levelCenter);
        LevelManager.outerPoints = pointManager.SpawnOuterPoints(LevelManager.innerPoints);

        playerManager.SpawnPlayers(pointManager.radius, ChooseControls.playerStates.Where(o => o.Value != PlayerState.Deactivated).Select(i => i.Key).ToArray());

        playerManager.PlayersLookAtPoint(_inGameManager.levelCenter);
        meshManager.SetMaterials();
        arqdutManager.SpawnArqduts(LevelManager.innerPoints, _inGameManager.levelCenter);

        meshManager.SetVertices(MeshManager.ConcatV2ListsToV3(LevelManager.innerPoints, LevelManager.outerPoints));
        _inGameManager.DrawMesh(corners);

        if (ChooseControls.gameStarted)
        {
            _gameManager.StartCountdown(_inGameManager.levelCenter);
        }
    }
Beispiel #4
0
    public void StartLerpSmaller(int playerOrder)
    {
        lerpPlayerNumber = playerOrder;

        LevelManager.innerLerpFrom = LevelManager.innerPoints;
        LevelManager.outerLerpFrom = LevelManager.outerPoints;

        // TODO there was error about index being out of bounds of array after ending game in circle. This method shouldn't even be called after player dies in circle
        float rotateAmount = 360 / (LevelManager.innerPoints.Count * 2) - rotationConstants[LevelManager.innerPoints.Count - 1] * playerOrder + _inGameManager.previousRotation; // Calculate rotation

        _inGameManager.previousRotation = rotateAmount;

        LevelManager.innerLerpTo = pointManager.SpawnInnerPoints(LevelManager.innerPoints.Count - 1, _inGameManager.levelCenter);
        pointManager.RotatePoints(LevelManager.innerLerpTo, rotateAmount); // Rotate inner points
        LevelManager.outerLerpTo = pointManager.SpawnOuterPoints(LevelManager.innerLerpTo);

        joiningPoints[0] = playerOrder;
        joiningPoints[1] = playerOrder + 1;

        _gameManager.StartCountdown(_inGameManager.levelCenter);
    }