void Collide(Transform trans, Vector3 point, Vector3 normal) { bool playerWasHit = DoDamageTo(trans, point); if (playerWasHit) { ScreenSpaceDebug.AddMessage("HIT", point, Color.green); } if (recoil > 0) { DoRecoil(point, playerWasHit); } if (playerWasHit) { EffectsScript.ExplosionHit(point, Quaternion.LookRotation(normal)); } else { EffectsScript.Explosion(point, Quaternion.LookRotation(normal)); } dead = true; Destroy(GetComponent <Rigidbody>()); GetComponent <Renderer>().enabled = false; }
// ReSharper disable once UnusedMember.Local protected void OthersReceiveHit(int damage, Vector3 point, uLink.NetworkViewID instigatorPresenceViewID) { EffectsScript.ExplosionHit( point, Quaternion.LookRotation( Vector3.up ) ); if (networkView.isMine) { DoDamageOwner(damage, point, PlayerPresence.TryGetPlayerPresenceFromNetworkViewID(instigatorPresenceViewID)); } }
void Awake() { // Register the singleton if (Instance != null) { Debug.LogError("Multiple instances of SpecialEffectsHelper!"); } Instance = this; }
public void Awake() { Instance = this; }
public void Update() { if( bounceCooldown > 0.0f && justBouncedPlayer ) bounceCooldown -= Time.deltaTime; else { justBouncedPlayer = false; } // TODO magical -104 number, what does it do? if( networkView.isMine && transform.position.y < KillHeight && !isInWater ) { isInWater = true; /*if( !justBouncedPlayer ) { justBouncedPlayer = true;*/ PlayerScript.StopFalling(); PlayerScript.AddRecoil( Vector3.up * 275.0f ); DoDamageOwner( 1, transform.position, PlayerScript.Possessor ); // Don't play water effect on death if (!dead) EffectsScript.PlayerWaterHitEffect(transform.position); /*bounceCooldown = 0.5f; } else {* justBouncedPlayer = false; DoDamageOwner( 3, transform.position, PlayerScript.Possessor ); }*/ } else { isInWater = false; } if (!firstSet && shieldRenderer != null) { shieldRenderer.material.SetColor("_TintColor", DefaultShieldColor); firstSet = true; } if(networkView.isMine) { timeUntilShieldRegen -= Time.deltaTime; if(timeUntilShieldRegen < 0 && Shield < maxShield) { timeUntilShieldRegen = shieldRegenTime; Shield += 1; UpdateShield(); } if (invulnerable) { timeSinceRespawn += Time.deltaTime; if (timeSinceRespawn > invulnerabilityTime) invulnerable = false; } } UpdateHealthSphereVisibility(); }