Example #1
0
    void Start()
    {
        if (isLocalPlayer)
        {
            // Initialize scripts
            healthScript = GetComponentInChildren <Health>();
            boatScript   = GetComponentInChildren <BoatMovementNetworked>();
            fireScripts  = GetComponentsInChildren <BroadsideCannonFireNetworked>();

            // Initialize UI components
            Transform crewUI    = GameObject.FindGameObjectWithTag("CrewManagementUI").transform;
            Transform attackUI  = crewUI.Find("AttackCrewUI");
            Transform defenseUI = crewUI.Find("DefenseCrewUI");
            Transform speedUI   = crewUI.Find("SpeedCrewUI");

            attackBar  = attackUI.GetComponentInChildren <Slider>();
            defenseBar = defenseUI.GetComponentInChildren <Slider>();
            speedBar   = speedUI.GetComponentInChildren <Slider>();

            attackText  = attackUI.GetComponentInChildren <Text>();
            defenseText = defenseUI.GetComponentInChildren <Text>();
            speedText   = speedUI.GetComponentInChildren <Text>();

            // Initialize Stats
            currentAttack  = BASE_ATTACK;
            currentDefense = BASE_DEFENSE;
            currentSpeed   = BASE_SPEED;

            attackMod  = MOD_MIN;
            defenseMod = MOD_MIN;
            speedMod   = MOD_MIN;

            for (int i = 0; i < fireScripts.Length; i++)
            {
                fireScripts[i].attackStat = currentAttack;
            }

            healthScript.defenseStat = currentDefense;
            boatScript.speedStat     = currentSpeed;

            // Initialize UI values
            attackBar.minValue = 0;
            attackBar.maxValue = BASE_ATTACK + MOD_MAX;
            attackBar.value    = BASE_ATTACK;
            attackText.text    = "Attack: " + currentAttack;

            defenseBar.minValue = 0;
            defenseBar.maxValue = BASE_DEFENSE + MOD_MAX;
            defenseBar.value    = BASE_DEFENSE;
            defenseText.text    = "Defense: " + currentDefense;

            speedBar.minValue = 0;
            speedBar.maxValue = BASE_SPEED + MOD_MAX;
            speedBar.value    = BASE_SPEED;
            speedText.text    = "Speed: " + currentSpeed;
        }
    }
Example #2
0
 void InitPlayerCameraPauseBool()
 {
     //If current scene is in MainLevel_PabloCamacho or MainLevel
     if (SceneManager.GetActiveScene().name.Contains("MainLevel") && MultiplayerManager.IsClient())
     {
         //get reference to player component BoatMovementNetworked
         Player     thisPlayer           = MultiplayerManager.GetLocalPlayer();
         GameObject thisPlayerGameObject = thisPlayer.GetPlayerObject();
         if (thisPlayerGameObject == null)
         {
             return;
         }
         playerBoatMovementComponent = thisPlayerGameObject.GetComponentInChildren <BoatMovementNetworked>();
     }
 }
Example #3
0
    // Use this for initialization
    void Start()
    {
        if (isLocalPlayer)
        {
            currentSpeedStage    = 0;
            currentFireRateStage = 0;
            currentDefenseStage  = 0;
            cooldownTimer        = 0;

            healthScript = GetComponentInChildren <Health>();
            boatScript   = GetComponentInChildren <BoatMovementNetworked>();
            fireScripts  = GetComponentsInChildren <BroadsideCannonFireNetworked>();

            // Locate & initialize UI and script components
            Transform crewUI    = GameObject.FindGameObjectWithTag("CrewManagementUI").transform;
            Transform attackUI  = crewUI.Find("AttackCrewUI");
            Transform defenseUI = crewUI.Find("DefenseCrewUI");
            Transform speedUI   = crewUI.Find("SpeedCrewUI");

            attackBar  = attackUI.GetComponentInChildren <Slider>();
            defenseBar = defenseUI.GetComponentInChildren <Slider>();
            speedBar   = speedUI.GetComponentInChildren <Slider>();

            attackText  = attackUI.GetComponentInChildren <Text>();
            defenseText = defenseUI.GetComponentInChildren <Text>();
            speedText   = speedUI.GetComponentInChildren <Text>();

            // Initialize UI bar min / max values
            attackBar.maxValue = stageMax;
            attackBar.minValue = stageMin;

            defenseBar.maxValue = stageMax;
            defenseBar.minValue = stageMin;

            speedBar.maxValue = stageMax;
            speedBar.minValue = stageMin;

            DisplayUpdate();
        }
    }
Example #4
0
 // Use this for initialization
 void Start()
 {
     movement = movementShip.GetComponent <BoatMovementNetworked>();
 }