Example #1
0
    public void OnPlayerDeath(TankManager tank, DamageData hit)
    {
        PlayerTankManager playerTank = (PlayerTankManager)tank;

        if (hit is TankProjectileDamageData)
        {
            TankProjectileDamageData tankHit = (TankProjectileDamageData)hit;
            TankManager killer = tankHit.projectileInstance.weaponData.ownerTank;
            if (killer)
            {
                int killerIndex = killer.tankID;
                Debug.Log(killerIndex);
                deathmatchPlayerData[killerIndex].currentKills++;
                Josh.EventSystem.EventResponder.TriggerEvent("DisplayText", playerTank.tankDisplayName.ToUpper() + " WAS KILLED BY " + killer.tankDisplayName.ToUpper());

                PlayerTankManager killerPlayerTank = (PlayerTankManager)killer;

                if (killerPlayerTank)
                {
                    ui.playerScoreUIDisplay.SetScore(killerIndex, deathmatchPlayerData[killerIndex].currentKills);
                    killerPlayerTank.quipSystem.SayQuip("Ha! Suck it, " + playerTank.tankDisplayName + "!");
                }
            }
        }
        int playerIndex = playerTank.tankID;

        deathmatchPlayerData[playerIndex].isDead          = true;
        deathmatchPlayerData[playerIndex].currentDeadTime = 0;
        deathmatchPlayerData[playerIndex].currentDeaths++;
    }
Example #2
0
    private void SpawnPlayer(int player, Vector3 position)
    {
        PlayerTankManager manager = players[player];

        manager.transform.position = position;
        manager.gameObject.SetActive(true);
        manager.SetRespawnParameters(gameMode.respawnTime, GetRespawnLocation);
        manager.ClearTrails();
    }
Example #3
0
    private Bounds GetCameraTrackingBounds()
    {
        Bounds newBounds = new Bounds(gameManager.players[0].transform.position, Vector3.zero);

        for (int i = 1; i < 4; i++)
        {
            if (!gameManager.IsPlayerValid(i))
            {
                continue;
            }
            PlayerTankManager tank = gameManager.players[i];
            newBounds.Encapsulate(tank.transform.position);
        }

        newBounds.size += (Vector3)offset;

        return(newBounds);
    }
Example #4
0
    public CpuTankManager[] SetTanks(GameObject playerTankPrefab, PlayerTankManager playerTank, GameObject cpuTankPrefab, GameObject cpuTankMovementLandMarkPrefab)
    {
        //player
        GameObject player = (GameObject)Instantiate(playerTankPrefab, playerPosition.position, playerPosition.rotation);

        //cpu
        for (int i = 0; i < cpuTankList.Length; i++)
        {
            GameObject landMark = (GameObject)Instantiate(cpuTankMovementLandMarkPrefab, cpuTankList[i].spawnPoint.position, cpuTankList[i].spawnPoint.rotation);
            landMark.GetComponent <CpuTankMovementLandMark>().targetObject = player;

            GameObject cpu = (GameObject)Instantiate(cpuTankPrefab, cpuTankList[i].spawnPoint.position, cpuTankList[i].spawnPoint.rotation);
            cpuTankList[i].instance             = cpu;
            cpuTankList[i].playerTank           = player;
            cpuTankList[i].tankMovementLandMark = landMark;
            cpuTankList[i].Setup();
        }

        playerTank.instance    = player;
        playerTank.cpuTankList = cpuTankList;
        playerTank.Setup();

        return(cpuTankList);
    }
Example #5
0
    private IEnumerator IntroEnumerator()
    {
        StartCoroutine(DelayMoveToNextStage(4));
        while (!moveToNextStage)
        {
            PanAndZoomTowards(Vector3.zero, 22, 20, 10);
            yield return(new WaitForEndOfFrame());
        }
        moveToNextStage = false;
        for (int i = 0; i < 4; i++)
        {
            if (gameManager.IsPlayerValid(i))
            {
                StartCoroutine(DelayMoveToNextStage(2));
                PlayerTankManager player = gameManager.players[i];
                while (!moveToNextStage)
                {
                    PanAndZoomTowards(player.transform.position, 10, 40, 10);
                    yield return(new WaitForEndOfFrame());
                }
                moveToNextStage = false;
            }
        }
        StartCoroutine(DelayMoveToNextStage(4));
        Bounds bounds = GetCameraTrackingBounds();
        float  zoom   = DetermineOrthographicSize(bounds);

        lastBounds = bounds;
        while (!moveToNextStage)
        {
            PanAndZoomTowards(bounds.center, zoom, 20, 10);
            yield return(new WaitForEndOfFrame());
        }
        moveToNextStage = false;
        cameraMode      = CameraMode.TrackingPlayers;
    }