void OnCollisionEnter(Collision col) { Dodgeball ball = col.gameObject.GetComponent <Dodgeball>(); Debug.Log(ball.isLive); if (ball && ball.isLive) { StartCoroutine(dieCycle()); } }
void OnCollisionEnter(Collision col) { Dodgeball ball = col.gameObject.GetComponent <Dodgeball>(); if (ball && ball.isLive) { GameController.onDeath(); //Destroy(gameObject); } }
Dodgeball ThrowNewBall(Vector3 position, Vector3 direction) { Dodgeball newBall = GameObject.Instantiate(dodgeballPrefab, position, Quaternion.identity).GetComponent <Dodgeball>(); newBall.transform.parent = this.transform; newBall.ID = DodgeBalls.Count; newBall.isLive = true; DodgeBalls.Add(newBall); newBall.ThrowBall(direction); return(newBall); }
private void ThrowDodgeball(Vector2 throwAtPoint) { Vector2 throwFromPoint = CalculateThrowFromPoint(throwAtPoint); Vector2 throwVelocity = CalculateThrowVelocity(throwFromPoint, throwAtPoint); // Spawn position is important for Dodgeball; set it at the Player and then offset it. Dodgeball dodgeball = Instantiate(dodgeballPrefab, transform.position, Quaternion.identity); dodgeball.SetPosition(throwFromPoint); dodgeball.SetVelocity(throwVelocity); dodgeball.SetTeam(player.Team); NetworkServer.Spawn(dodgeball.gameObject); }
void OnTriggerEnter(Collider coll) { Dodgeball d = coll.GetComponent <Dodgeball>(); if (d != null) { if (d.teamOn != teamOn && d.isActive) { player.CatchBall(d.playerID, d.GetComponent <PhotonView>().viewID); } } }
public void OnTriggerEnter(Collider coll) { Dodgeball d = coll.GetComponent <Dodgeball>(); if (d != null) { coll.GetComponent <PhotonView>().RPC("RPC_SetTeam", PhotonTargets.All, team, player.viewID); coll.GetComponent <PhotonView>().RPC("RPC_SetVelocity", PhotonTargets.All, (player.transform.forward.normalized * 25 + up) * 1.3f); coll.GetComponent <PhotonView>().RPC("RPC_Bunt", PhotonTargets.All); hasHit = true; sounds.clips[1].Play(); } }
private void OnCollisionEnter2D(Collision2D collision) { GameObject hitObject = collision.gameObject; EnemyDeath enemy = hitObject.GetComponent <EnemyDeath>(); Dodgeball dodgeball = hitObject.GetComponent <Dodgeball>(); ShieldPowerUp shield = hitObject.GetComponent <ShieldPowerUp>(); if (hitObject == GameObject.Find("Player")) { PlayerCharacter p = hitObject.GetComponent <PlayerCharacter>(); p.Hurt(); Destroy(this.gameObject); } //I don't know if we want the enemy to be destroyed by its own dodgeballs else if (enemy != null) { //enemy.Die(); Destroy(this.gameObject); } else if (shield != null) { Destroy(this.gameObject); } /* else if (dodgeball != null) * { * var speed = lastVelocity.magnitude; //We can reduce this if we want * var direction = Vector3.Reflect(lastVelocity.normalized, collision.contacts[0].normal); * * rb.velocity = direction * speed; * } *///cool idea but causes ball interaction glitches else { Destroy(this.gameObject); } }
void OnEnable() { _evCtrl = (Dodgeball)target; }
private void HandleServerDodgeballDespawned(Dodgeball dodgeball) { }
private void HandleDodgeballDespawned(Dodgeball dodgeball) { dodgeballs.Remove(dodgeball); }
private void HandleDodgeballSpawned(Dodgeball dodgeball) { dodgeballs.Add(dodgeball); }
// Use this for initialization void Start() { ball_Current = Ball; ball_Start_Location = GetComponentInChildren <ShootLocation>().transform.position; m_Player_Info = GetComponent <PlayerInfo>(); }
public void onNetworkThrowBall(Vector3 position, Vector3 direction) { Dodgeball newBall = ThrowNewBall(position, direction); }
public void ThrowBall(Vector3 position, Vector3 direction) { Dodgeball newBall = ThrowNewBall(position, direction); network.ThrowBall(newBall.ID, position, direction); }