//-------------------------------------------------------------------------------------------------- // Update is called once per frame void Update() { if (findTeamController == false) { if (teamNum == 1) { teamController = GameObject.Find("Team1"); } else if (teamNum == 2) { teamController = GameObject.Find("Team2"); } findTeamController = true; } if (myPlayer.GetButtonDown("Pause")) { m_my_Pauser.Pauser(); } if (transform.position.x < -7.5) { transform.position = new Vector2(-7.5f, transform.position.y); } else if (transform.position.x > 7.5) { transform.position = new Vector2(7.5f, transform.position.y); } if (myPlayer.GetButtonDown("Switch") && status == Status.Free) { try { Debug.Log(teamController.name); teamController.GetComponent <SwitchHandler>().BeginSwap(playerNum); } catch { } } if (status == Status.Free) { horizontalInput = myPlayer.GetAxisRaw("Horizontal"); if (horizontalInput >= 0.1f && !is_Looking_Right) { gameObject.transform.localScale = new Vector3(-original_Scale.x, transform.localScale.y, transform.localScale.z); is_Looking_Right = true; } if (horizontalInput <= -0.1f && is_Looking_Right) { gameObject.transform.localScale = new Vector3(original_Scale.x, transform.localScale.y, transform.localScale.z); is_Looking_Right = false; } } else { horizontalInput = 0; if (transform.position.x != myMachine.transform.position.x) { transform.position = new Vector3(myMachine.transform.position.x, transform.position.y, transform.position.z); } } if (transform.position.y != m_initial_Y_Pos) { transform.position = new Vector3(transform.position.x, m_initial_Y_Pos, transform.position.z); } // If player is infront of machine and they press "Jump" and they are free, set their status to at a machine // Give the machine my inputs. // If the player presses "Jump" and is using a machine, set them to free again. // Also if they press heavy attack, they jump off the machine without using it. if (is_In_Area && (myPlayer.GetButtonDown("Jump"))) { if (status == Status.Free && !myMachine.GetComponent <MachineBehaviour>().is_In_Use) { status = Status.AtMachine; if (!myMachine.GetComponent <MachineBehaviour>().is_In_Use) { myMachine.GetComponent <MachineBehaviour>().Commence_Control(playerNum, teamID, gameObject); myPlayer.SetVibration(0, light_Vib, light_Time); } Debug.Log(status); } } if (is_In_Area && (myPlayer.GetButtonDown("HeavyAttack"))) { if (myMachine.GetComponent <MachineBehaviour>().is_In_Use) { myMachine.GetComponent <MachineBehaviour>().End_Control(); myMachine = null; myPlayer.SetVibration(0, light_Vib, light_Time); //Debug.Log("Has detached from machine with Heavy Attack"); } if (status == Status.AtMachine) { status = Status.Free; //Debug.Log(status); } } if (status == Status.AtMachine && myPlayer.GetButtonDown("BasicAttack")) { status = Status.Free; if (myMachine.GetComponent <MachineBehaviour>().is_In_Use) { myPlayer.SetVibration(0, Heavy_Vib, Heavy_Time); myMachine.GetComponent <MachineBehaviour>().Fire_Off_Machine(); myMachine.GetComponent <MachineBehaviour>().End_Control(); Debug.Log("Has detached from machine with Jump"); } } Handle_Animations(); }
// Update is called once per frame void Update() { if (!isDead) { //resetting the health in case it ever goes above if (currentHealth > maxHealth) { currentHealth = maxHealth; } //setting the health if (healthBar != null && regenableHealthBar != null) { healthBar.fillAmount = currentHealth / maxHealth; regenableHealthBar.fillAmount = regenHeath / maxHealth; } if (Time.timeScale == 1) { Movement(); if (!isAttacking) { Attack(); } } if (findTeamController == false) { if (teamNum == 1) { teamController = GameObject.Find("Team1"); } else if (teamNum == 2) { teamController = GameObject.Find("Team2"); } findTeamController = true; //Hey Nick. Itsa me. Your good pal Nolan. Let me know if you find this } if (myPlayer.GetButtonDown("Switch")) { Debug.Log(teamController.name); try { teamController.GetComponent <SwitchHandler>().BeginSwap(playerNum); } catch { } } } else { anim.SetBool("IsDead", true); for (int i = 0; i < boxColliders.Length; i++) { boxColliders[i].enabled = false; } for (int i = 0; i < polygonColliders.Length; i++) { polygonColliders[i].enabled = false; } } if (myPlayer.GetButtonDown("Pause")) { m_my_Pauser.Pauser(); } }
// Update is called once per frame void Update() { Debug.Log("Horizontal: " + myPlayer.GetAxis("Horizontal")); Debug.Log("Vertical: " + myPlayer.GetAxis("Vertical")); attackTimerDelay -= Time.deltaTime; landtimer -= Time.deltaTime; if (findTeamController == false) { if (teamNum == 1) { teamController = GameObject.Find("Team1"); } else if (teamNum == 2) { teamController = GameObject.Find("Team2"); } findTeamController = true; } if (myPlayer.GetButtonDown("Switch")) { Debug.Log(teamController.name); try { teamController.GetComponent <SwitchHandler>().BeginSwap(playerNum); }catch { } } if (myPlayer.GetButtonDown("Pause")) { m_my_Pauser.Pauser(); } //<3 for Justin //-Love Dan 🦆 //Here's additional recognition for our one true leader throughout this endeavorous task //set upon us, for without him we are nothing. //Praise be to our one and only team manager Patrick ♥♥♥♥♥♥♥♥ //I hate you Pat. You are not only a regular garbage person, but you are THE garbage man, who eats trash but isn't Danny Devito. if (currentHealth > maxHealth) { currentHealth = maxHealth; } if (onTopOfPlatform && gillbert && currentGilbertFlightTime < gilbertFlightTime) { if (currentGilbertFlightTime < 0) { currentGilbertFlightTime = 0; } currentGilbertFlightTime += Time.deltaTime * 2; } //Debug.Log(isAttacking); stunTime -= Time.deltaTime; if (healthBar != null && regenableHealthBar != null) { healthBar.fillAmount = currentHealth / maxHealth; regenableHealthBar.fillAmount = regenHeath / maxHealth; } if (!isAttacking && !isJumping && stunTime <= 0) { Attack(); } if (doAttackMovementTimer > 0 && attackTimerDelay < 0) { doAttackMovementTimer -= Time.deltaTime; } if (stunTime <= 0 && !inHitAnims && doAttackMovementTimer <= 0) { Movement(); } //Reset the velocity whenever the player attacks /* * else * { * accel = 0; * velocity = new Vector3(0, 0, 0); * } */ }