public void RemoveShield() { isShielded = false; CarShooting thisCar = GetComponent <CarShooting>(); thisCar.RemoveShield(); }
private void OnTriggerEnter(Collider other) { if (!Taken) { // "Hide" the mesh m_Renderer.material = m_HiddenMaterial; // Make sure nobody else can take the pickup Taken = true; // Show countdown text m_Text.enabled = true; // Give pickup to player Rigidbody targetRigidBody = other.GetComponent <Rigidbody>(); if (other.GetComponent <CarMovement>() != null) { other.GetComponent <CarMovement>().CmdIncreasePoints(200); } if (targetRigidBody && targetRigidBody.GetComponent <CarShooting>() != null) { if (isEvil) { CarHealth targetCarHealh = other.GetComponent <CarHealth>(); evilExplode.Play(); targetCarHealh.CmdTakeDamage(25); } else { m_PickupVariable = DateTime.Now.Millisecond % 10.0f; if (m_PickupVariable < 3) { CarShooting targetShooting = targetRigidBody.GetComponent <CarShooting>(); targetShooting.GetNewPickup(0); } else if (m_PickupVariable >= 3 && m_PickupVariable <= 7) { CarShooting targetShooting = targetRigidBody.GetComponent <CarShooting>(); targetShooting.GetNewPickup(1); } else { CarShooting targetShooting = targetRigidBody.GetComponent <CarShooting>(); targetShooting.GetNewPickup(2); } } } } }
public void Setup() { m_Movement = m_Instance.GetComponent <CarMovement>(); m_Shooting = m_Instance.GetComponent <CarShooting>(); thisCamera = m_Instance.GetComponentInChildren <Camera>(); m_Movement.m_PlayerNumber = m_PlayerNumber; m_Shooting.m_PlayerNumber = m_PlayerNumber; m_ColoredPlayerText = "<color=#" + ColorUtility.ToHtmlStringRGB(m_PlayerColor) + ">PLAYER " + m_PlayerNumber + "</color>"; MeshRenderer[] renderers = m_Instance.GetComponentsInChildren <MeshRenderer>(); for (int i = 0; i < renderers.Length; i++) { renderers[i].material.color = m_PlayerColor; } }