public void OponentHealth(float thehealths) { if (Oponenthealthbar) { Oponenthealthbar.SetHealth(thehealths); } ; }
public void Damage2(float TheDamageAmont) { if (MenuController.power == 2 && photonView.isMine) { StartCoroutine("visible"); } currentHealth -= TheDamageAmont; healthbar.SetHealth(currentHealth); StartCoroutine("WaitForRegenerating"); photonView.RPC("OponentHealth", PhotonTargets.Others, currentHealth); }
public void jumpBoostLevelUp() { jumpBoost += 1; jumpForce += 50; SaveJumpForce += 500; JumpboostBar.SetHealth(jumpBoost); }
public void Damage2(float TheDamageAmont) { currentHealth -= TheDamageAmont; healthbar.SetHealth(currentHealth); StartCoroutine("WaitForRegenerating"); photonView.RPC("OponentHealth", PhotonTargets.Others, currentHealth); }
public void strengthBoostLevelUp() { strengthBoost += 1; damage[] strength = GetComponentsInChildren <damage>(); foreach (damage strength2 in strength) { strength2.multiplyer += 0.1f; } StrenghtBar.SetHealth(strengthBoost); }
public void TakeDamage(int damage1) { currentHealth -= damage1; healthBar.SetHealth(currentHealth); if (currentHealth <= 60) { anim.SetBool("Hp1", true); } if (currentHealth <= 30) { anim.SetBool("Hp1", false); anim.SetBool("Hp2", true); } if (currentHealth <= 0) { anim.SetBool("Hp2", false); Die(); } }
private void Update() { if (ownplayernumber == GameManager.playernumber) { if (Input.GetKeyDown(KeyCode.Space) || ((joystick != null && joystick.Vertical >= 0.3) && Onlyonce == true)) { Onlyonce = false; photonView.RPC("Jumping", PhotonTargets.MasterClient); } else if (joystick != null && joystick.Vertical <= 0.3) { Onlyonce = true; } } if (isFrozen == false && Dead == false) { FixedJoint2D[] freeze = GetComponentsInChildren <FixedJoint2D>(); foreach (FixedJoint2D frozen in freeze) { if (frozen.gameObject.name != "Chest" && frozen.gameObject.name != "Neck") { frozen.enabled = false; } } Rigidbody2D[] rigidbodies = GetComponentsInChildren <Rigidbody2D>(); foreach (Rigidbody2D rbs in rigidbodies) { rbs.freezeRotation = false; } } else if (isFrozen == true && Dead == false) { Rigidbody2D[] rigidbodies = GetComponentsInChildren <Rigidbody2D>(); foreach (Rigidbody2D rbs in rigidbodies) { rbs.freezeRotation = true; } } FixedJoystick[] fixedJoysticks = FindObjectsOfType <FixedJoystick>(); if (GameManager.HandyControllsOn == true) { foreach (FixedJoystick joysticks in fixedJoysticks) { if (joysticks.tag == "Joystick") { joystick = joysticks; } } } else { joystick = null; } FixedJoystick[] fixedJoysticks2 = FindObjectsOfType <FixedJoystick>(); if (GameManager.HandyControllsOn == true) { foreach (FixedJoystick joysticks2 in fixedJoysticks2) { if (joysticks2.tag == "Joystick2") { joystick2 = joysticks2; } } } else { joystick2 = null; } if (Input.GetKeyDown(KeyCode.UpArrow) && Input.GetKeyDown(KeyCode.B)) { //Acivate John Cena JohnCena = true; } if (photonView.isMine) { energybar.SetHealth(currentEnergy); } if (lr.enabled == true && GameObject.FindGameObjectWithTag("RightFist")) { lr.SetPosition(0, GameObject.FindGameObjectWithTag("RightFist").transform.position); } lr.SetPosition(1, Hand1.transform.position); if (MenuController.power == 1 && photonView.isMine) { if ((GameManager.HandyControllsOn == false && Input.GetKeyDown(KeyCode.Mouse0)) || (joystick2 != null && joystick2.Direction != new Vector2(0, 0) && Onlyonce2 == true)) { StartCoroutine("shoot"); Onlyonce2 = false; } if ((GameManager.HandyControllsOn == false && Input.GetKeyUp(KeyCode.Mouse0)) || (joystick2 != null && joystick2.Direction == new Vector2(0, 0))) { Onlyonce2 = true; photonView.RPC("stopGrapling", PhotonTargets.All); springjoint.enabled = false; GameObject.FindGameObjectWithTag("LowerArm").GetComponent <FollowMouse>().enabled = true; GameObject.FindGameObjectWithTag("UpperArm").GetComponent <FollowMouse>().enabled = true; } Vector2 transform2D = new Vector2(Hand1.transform.position.x, Hand1.transform.position.y); //if (Vector2.Distance(springjoint.connectedAnchor, transform2D) <= 5 && !Input.GetKey(KeyCode.Mouse0)) //springjoint.enabled = false; } else { //lr.enabled = false; //springjoint.enabled = false; } if (currentHealth <= 0 && Dead == false) { Dead = true; StartCoroutine("deadbody"); if (MenuController.selectedgamemode != 2 && MenuController.selectedgamemode != 1 && photonView.isMine) { GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>().StartCoroutine("Respawn"); } } if (GameManager.playernumber == 1 && Dead == false && isFrozen == false) { KeyInput(); } }
private void Start() { if (MenuController.power == 3) { damage[] dammage = GetComponentsInChildren <damage>(); foreach (damage DAMAGE in dammage) { DAMAGE.multiplyer = 0.8f; } } GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); ownplayernumber = players.Length; if (MenuController.power == 2) { maxEnergy = 50; } dashCount = startDashCount; camerashake = FindObjectOfType <Camera>().GetComponent <StressReceiver>(); if (MenuController.power == 3 && photonView.isMine) { maxHealth += 50; SaveJumpForce += 1000; jumpForce += 1000; FollowMouse[] thefollowMouse = GetComponentsInChildren <FollowMouse>(); foreach (FollowMouse FollowTheMouse in thefollowMouse) { FollowTheMouse.Maxspeed += 10; } Rigidbody2D[] rbChildren = GetComponentsInChildren <Rigidbody2D>(); foreach (Rigidbody2D RBCHILDREN in rbChildren) { RBCHILDREN.mass += 0.1f; } } OnFireParticles.Stop(); FireParticles.Stop(); psIce.Stop(); if (MenuController.power == 2 && photonView.isMine) { SpriteRenderer[] Transparency = GetComponentsInChildren <SpriteRenderer>(); foreach (SpriteRenderer theTransparency in Transparency) { theTransparency.color = new Color(0.15f, 0.15f, 0.15f, 1f); } photonView.RPC("Invisibillity", PhotonTargets.OthersBuffered); photonView.RPC("hidehealthbar", PhotonTargets.OthersBuffered); } if (MenuController.power == 3 && photonView.isMine) { maxEnergy -= 50; } currentEnergy = maxEnergy; readytofire = true; springjoint.enabled = false; lr.enabled = false; FollowMouse[] followMouse = GetComponentsInChildren <FollowMouse>(); foreach (FollowMouse FollowTheMouse in followMouse) { FollowTheMouse.enabled = true; } springjoint = GetComponentInChildren <SpringJoint2D>(); cam = FindObjectOfType <Camera>(); if (MenuController.selectedgamemode == 2) { SpeedBar = GameObject.FindGameObjectWithTag("SpeedBar").GetComponent <HelthBar>(); StrenghtBar = GameObject.FindGameObjectWithTag("StrenghtBar").GetComponent <HelthBar>(); HealthboostBar = GameObject.FindGameObjectWithTag("HealthboostBar").GetComponent <HelthBar>(); JumpboostBar = GameObject.FindGameObjectWithTag("JumpboostBar").GetComponent <HelthBar>(); HealthboostBar.SetMaxHealth(20); StrenghtBar.SetMaxHealth(20); JumpboostBar.SetMaxHealth(20); SpeedBar.SetMaxHealth(20); HealthboostBar.SetHealth(0); StrenghtBar.SetHealth(0); JumpboostBar.SetHealth(0); SpeedBar.SetHealth(0); } healthbar = GameObject.FindGameObjectWithTag("OwnHealthBar").GetComponent <HelthBar>(); energybar = GameObject.FindGameObjectWithTag("EnergyBar").GetComponent <HelthBar>(); GameObject[] oponenthealthbars = GameObject.FindGameObjectsWithTag("OponentsHealthbar"); if (photonView.isMine) { energybar.SetMaxHealth(maxEnergy); } foreach (GameObject thehealth in oponenthealthbars) { if (!thehealth.GetComponent <PhotonView>().isMine) { Oponenthealthbar = thehealth.GetComponent <HelthBar>(); thehealth.SetActive(true); } else { thehealth.SetActive(false); } } if (GameManager.playernumber == ownplayernumber && MenuController.selectedgamemode == 5) { Snow.Play(); } jumpForce *= 1.75f; currentHealth = maxHealth; healthbar.SetMaxHealth(maxHealth); if (Oponenthealthbar) { Oponenthealthbar.SetMaxHealth(maxHealth); } Rigidbody2D[] Gravity01 = GetComponentsInChildren <Rigidbody2D>(); SaveJumpForce = jumpForce; if (GameManager.playernumber != 1) { Rigidbody2D[] rbChildren = GetComponentsInChildren <Rigidbody2D>(); foreach (Rigidbody2D RBCHILDREN in rbChildren) { RBCHILDREN.isKinematic = true; RBCHILDREN.gravityScale = 0; } } if (MenuController.selectedgamemode == 4) { maxHealth += 100; } }
public void healthBoostLevelUp() { healthBoost += 1; maxHealth += 25f; HealthboostBar.SetHealth(healthBoost); }
public void speedBoostLevelUp() { speedBoost += 1; playerSpeed += 250; SpeedBar.SetHealth(speedBoost); }