void Awake() { instance = this; if (ThirdPartyController.Instance.CheckAdsCounter()) { ThirdPartyController.Instance.ShowInterstitial(true); } }
/// <summary> /// Respawning. Only Graphical UNLESS is our Player. Then we reposition ourselves. /// </summary> /// <param name="spawnPoint"></param> public override void Respawn(Vector3 spawnPoint) { if (_PhotonView.isMine) { transform.position = spawnPoint; GameHUDController.LoseALife(); GameHUDController.ResetDamage(); damage = 0; } _Rigibody2D.isKinematic = false; StartCoroutine(spawnProtection()); }
private void _GameStart(int myID, string charName) { gameStarted = true; SettingsManager.SetGameInfo(startingLives, gameLength); startTime = Time.time; startingPlayers = N.ReadyTotal; gameLength = SettingsManager._GameLength; killsMatrix = new int[N.ReadyTotal, N.ReadyTotal]; for (int x = 0; x < N.ReadyTotal; x++) { for (int y = 0; y < N.ReadyTotal; y++) { killsMatrix[x, y] = 0; } } SpawnPositions = new Transform[N.ReadyTotal]; for (int x = 0; x < N.ReadyTotal; x++) { SpawnPositions[x] = GameObject.FindGameObjectWithTag("SpawnPoints").transform.GetChild(x); } CBUG.Do("Player " + myID + " Spawning " + charName); Vector3 spawnPos; spawnPos = SpawnPositions[myID].position; PhotonNetwork.Instantiate(charName, spawnPos, Quaternion.identity, 0); playerLives = new int[N.ReadyTotal]; for (int x = 0; x < N.ReadyTotal; x++) { playerLives[x] = SettingsManager._StartLives; } GameHUDController.SetLives(SettingsManager._StartLives); }
void OnTriggerEnter2D(Collider2D col) { //if (col.name == "Physics Box(Clone)") //{ // CBUG.Log("PUNCH"); // if(transform.localScale.x > 0){ // col.GetComponent<Rigidbody2D>().AddForce(new Vector2(BoxPunch, BoxPunch), ForceMode2D.Impulse); // }else{ // col.GetComponent<Rigidbody2D>().AddForce(new Vector2(-BoxPunch, BoxPunch), ForceMode2D.Impulse); // } //} if (isDead || col == null || !_PhotonView.isMine) { return; } //apply force . . . else if (col.name.Contains("Punch")) { //Get name of puncher lastHitBy = col.GetComponentInParent <PlayerController2DOnline>().SlotNum; lastHitTime = Time.time; if (invincibilityCount > 0) { return; } else { invincibilityCount = InvicibilityFrames; } damage += PunchPercentAdd; if (damage < 30) { _PhotonView.RPC("HurtAnim", PhotonTargets.All, 1); } else if (damage < 60) { _PhotonView.RPC("HurtAnim", PhotonTargets.All, 2); } else { _PhotonView.RPC("HurtAnim", PhotonTargets.All, 3); } GameHUDController.SetDamageTo(damage); if (col.name == "PunchForward") { //velocity += Vector2.right * PunchForceForward_Forward; if (col.transform.parent.localScale.x > 0) { Vector2 temp = Vector2.right * (PunchForceForward_Forward + StrengthsList[col.transform.parent.name] - Defense); temp += Vector2.up * (PunchForceForward_Up + StrengthsList[col.transform.parent.name] - Defense); StartCoroutine( applyPunchForce(temp * (damage / 100f)) ); } else { Vector2 temp = Vector2.left * (PunchForceForward_Forward + StrengthsList[col.transform.parent.name] - Defense); temp += Vector2.up * (PunchForceForward_Up + StrengthsList[col.transform.parent.name] - Defense); StartCoroutine( applyPunchForce(temp * (damage / 100f)) ); } } else if (col.name == "PunchUp") { StartCoroutine( applyPunchForce( (Vector2.up * (PunchForceUp + StrengthsList[col.transform.parent.name] - Defense) * (damage / 100f)) ) ); } else { if (!isGrounded) { StartCoroutine( applyPunchForce( (Vector2.down * (PunchForceDown + StrengthsList[col.transform.parent.name] - Defense) * (damage / 100f)) ) ); } else { StartCoroutine( applyPunchForce( (Vector2.up * (PunchForceDown + StrengthsList[col.transform.parent.name] - Defense) * (damage / 200f)) ) ); } } } }
public void SetNewTarget() { CamManager.SetTarget(transform); GameHUDController.SetDamageTo(damage); }
void Start() { instance = this; Init(); }