public void setupCamsRenderTexturesMethod(thisPlayerPairSettings ourShipsPlayerPairSettings) { //putting the finding objects in here because found previously that the start wont necessarily run first //later on refactor maybe the setup void should be a constructor //also its just wiring up so why have it in trigger battle cams maybe own script - yep now it is //code assumes goes left right maybe thats sloppy though less intensive than string comparison //if works would be far neater if made playersettings use a string array going left right tacticalScreens = GetComponentsInChildren <RawImage>(); tacticalCams = GetComponentsInChildren <Camera>(); for (int i = 0; i < 2; i++) { if (i == 0) { RenderTexture renderTexture = Resources.Load <RenderTexture>(ourShipsPlayerPairSettings.GetBattleCamRenderTextureLeft()); tacticalCams[i].targetTexture = renderTexture; tacticalScreens[i].texture = renderTexture; } if (i == 1) { RenderTexture renderTexture = Resources.Load <RenderTexture>(ourShipsPlayerPairSettings.GetBattleCamRenderTextureRight()); tacticalCams[i].targetTexture = renderTexture; tacticalScreens[i].texture = renderTexture; } } }
public void changeTheSails(thisPlayerPairSettings ourPPS) { string colorToFind = ourPPS.getShipPairColor(); Debug.Log(colorToFind); //try number //try 1 didnt error but didnt do it either it set sail to instance Material fetchedMaterial = Resources.Load <Material>(colorToFind); //sailColor = fetchedMaterial; //then try as shaders on sail and material try 2 //sailColor.shader = fetchedMaterial.shader; // caused not set to instance of an object //try 3 Material material = GetComponent <SkinnedMeshRenderer>().material; //material = fetchedMaterial; //try4 //material.shader = fetchedMaterial.shader; //next try set options //then try setting the shader ot the madetial material.CopyPropertiesFromMaterial(fetchedMaterial); }
public void passMeMyPlayerPairSettings(thisPlayerPairSettings barsPlayerPairSettings) { //Debug.Log("im receiring my player pairsettings"); this.myPPSettings = barsPlayerPairSettings; volt100Perc = this.myPPSettings.GetVolt100Perc(); //probs only need calling once unless being set receivedMyPlayerPairSettings = true; //Debug.Log(" I am perc bar " + this.gameObject.tag +"I have received " + myPPSettings.getShipPairColor()+ " settings "); }
// Use this for initialization void Start() { shipSelectedIndicator = GetComponent <Image>(); selectedColor = shipSelectedIndicator.color; foreach (thisPlayerPairSettings pairShip in GameManager.shipPlayerSettingsAr) { if (tag == pairShip.getShipPairColor()) { myThisPlayerPairSettings = pairShip; } } }
private int selectedTeamNumber = -1; //little bit hacky how do i do a for loop that runs an if that if nothing found does an else // Use this for initialization void Start() { foreach (thisPlayerPairSettings playerPairSettings in GameManager.shipPlayerSettingsAr) { if (tag == playerPairSettings.getShipPairColor()) { myThisPlayerPairSettings = playerPairSettings; } } arrowImage = GetComponentInChildren <Image>(); arrowImage.color = Color.red;//should get first startScaleArrow = arrowImage.gameObject.GetComponent <RectTransform>().localScale; textTimer = GetComponentInChildren <Text>(); }
public void runSetMaxFor(thisPlayerPairSettings givenThisPlayerSettingsRivalOrPair) /// if you want to feed something a static how do you do it as they dont have an instance // Debug.Log("I am " + tag + " I have been assigned " + givenThisPlayerSettingsRivalOrPair.getShipPairColor() ); { foreach (thisPlayerPairSettings pairSettings in GameManager.shipPlayerSettingsAr) { if (pairSettings.getShipPairColor() == this.gameObject.tag) { myThisPlayerPairSettings = pairSettings; } } rivalOrOwnPair = givenThisPlayerSettingsRivalOrPair; runSetMax = true; updateTxtAndDisplayWithRivalInfo(); }
public void applyPlayerSettingsToShip(thisPlayerPairSettings shipsPlayerPairSettings) { // Debug.Log("instantiated player about to received their this player pair settings"); ourShipsPlayerPairSettings = shipsPlayerPairSettings; //set battle cams to their render textures setupBattleCams = GetComponentInChildren <setupBattleCamsRenderTextures>(); setupBattleCams.setupCamsRenderTexturesMethod(ourShipsPlayerPairSettings); //set color //set team number () - public so spawner can read it - and apply it to physics collision matrix sorting layers // Debug.Log(" orvolt100perc before received settings is " + ourVolt100PercMax); ourVolt100PercMax = ourShipsPlayerPairSettings.GetVolt100Perc(); // Debug.Log(" orvolt100perc after received settings is " + ourVolt100PercMax); //view port //Rect splitScreen = ourShipsPlayerPairSettings.GetSplitScreenArea(); // myMainCamera.rect.Set() ; //not sure if this need word new should because its like a vector but then goes red so dunno //most be a better way //could just instead of rect have a float array but seems dumb //dumb to to have to pull each float out of rec //is the issue actually how i pass the info //okay so above may not be the problem so on refactor maybe rect can be passed better //the issue was this code running before the start code //i thought start was like a constructor but it isnt //maybe instead of start this code should require a constructor myMainCamera = GetComponentInChildren <Camera>(); // Debug.Log("my main camera " + myMainCamera + " my main camera rect " + myMainCamera.rect ); myMainCamera.rect = new Rect(ourShipsPlayerPairSettings.GetSplitScreenArea().x, ourShipsPlayerPairSettings.GetSplitScreenArea().y, ourShipsPlayerPairSettings.GetSplitScreenArea().width, ourShipsPlayerPairSettings.GetSplitScreenArea().height); // Debug.Log("confirming that " + tag + " has been set up so it should know its volt input "); //give the ship spray its powerbars percBarDisplay[] foams = GetComponentsInChildren <percBarDisplay>(); foreach (percBarDisplay bar in foams) { bar.passMeMyPlayerPairSettings(ourShipsPlayerPairSettings); } //set ship sail colour GetComponentInChildren <shipSailColor>().changeTheSails(ourShipsPlayerPairSettings); shipBeenSetUp = true; }
private void allocate2dArraySplitScreenRect(thisPlayerPairSettings shipToAllocateRect) { for (int k = splitScreenQuarters.GetLength(1) - 1; k >= 0; k--) { for (int j = 0; j < splitScreenQuarters.GetLength(0); j++) { { // Debug.Log(" k is " + k + "j is " + j ); if (splitScreenQuarters[j, k] == 0) { splitScreenQuarters[j, k] = 1; Rect thisShipRect = new Rect(((float)j * 0.5f), ((float)k * 0.5f), 0.5f, 0.5f); shipToAllocateRect.SetSplitScreenArea(thisShipRect); // Debug.Log(" just gave " + shipToAllocateRect.getShipPairColor() + " the k,j " + k+j + " which is the rect " + thisShipRect ); return; } } } } }
private void settingUpPlayerSettingAr() //dont think i can run without an instance as without an instance dont think i can store values { //code seems to need this block but not sure why as can use the dot to find what looking for redPShip = new thisPlayerPairSettings { }; yelPShip = new thisPlayerPairSettings { }; grePShip = new thisPlayerPairSettings { }; bluPShip = new thisPlayerPairSettings { }; redPShip.SetShipPairName(" MondleBrot's Wives "); yelPShip.SetShipPairName(" Brownian's Movement "); grePShip.SetShipPairName(" Marie's Glow "); bluPShip.SetShipPairName(" Dabloon 's Good Booty! "); redPShip.setShipPairColor("RED"); yelPShip.setShipPairColor("YELLOW"); grePShip.setShipPairColor("GREEN"); bluPShip.setShipPairColor("BLUE"); redPShip.SetBattleCamRenderTextureLeft("REDLEFTRENDERTEXTURE"); redPShip.SetBattleCamRenderTextureRight("REDRIGHTRENDERTEXTURE"); yelPShip.SetBattleCamRenderTextureLeft("YELLEFTRENDERTEXTURE"); yelPShip.SetBattleCamRenderTextureRight("YELRIGHTRENDERTEXTURE"); grePShip.SetBattleCamRenderTextureLeft("GRELEFTRENDERTEXTURE"); grePShip.SetBattleCamRenderTextureRight("GRERIGHTRENDERTEXTURE"); bluPShip.SetBattleCamRenderTextureLeft("BLULEFTRENDERTEXTURE"); bluPShip.SetBattleCamRenderTextureRight("BLURIGHTRENDERTEXTURE"); shipPlayerSettingsAr = new thisPlayerPairSettings[] { redPShip, yelPShip, grePShip, bluPShip }; }