void Start() { ThirstQuencher = GetComponentInChildren <ProximityTriggerAction>(); ThirstQuencher.triggerStayDelegate += CheckDrinkingWhiskey; ThirstQuencher.triggerExitDelegate += StopDrinking; gulpSource = AudioManager.Inst.MakeSource("Bottle/DrinkingInGulps"); gulpSource.transform.SetParent(VRMimic.Instance.VRCamera.transform); gulpSource.transform.localPosition = Vector3.up * -.4f; gulpSource.volume = 0; gulpSource.loop = true; gulpSource.Play(); myDestroyable = GetComponent <Destroyable>(); myExplodable = GetComponent <Explodable>(); myExplosion = GetComponent <Explosion>(); //if (swishCalculator != null) //{ //swishCalculator = transform.FindChild("bottle2").FindChild("Whiskey Swish").GetComponent<Swish>(); //} //myExplodable.HitByExplosionDelegate += HitByExplosion; }
public bool RecieveExplosion(Explosion.ExplosionInfo info) { if (HasFlag(ExplosionResponse.None)) { return(false); } Vector3 direction = transform.position - info.explosionCenter; Vector3 blast = Vector3.Scale(direction.normalized, info.forceMultipliers); //Debug.Log("I have recieved an explosion\t" + name + "\n\tForce: " + forceMultipliers); if (HasFlag(ExplosionResponse.Rigidbody)) { if (rb != null) { if (rb.isKinematic && info.source.RemoveKinematicAttribute) { rb.isKinematic = false; rb.useGravity = true; } //Debug.Log("Applying force to " + name + "\n"); rb.AddForce(blast, ForceMode.Impulse); } } if (HasFlag(ExplosionResponse.Haptics)) { if (info.explosionSequence != null) { var Where = HardlightSuit.Find().FindNearestFlag(info.explosionCenter, 5); HardlightSuit.Find().EmanatingHit(Where, info.explosionSequence, .25f, 8); } } if (HasFlag(ExplosionResponse.Fireworks)) { //Create a visual effect at the point of impact? } if (HasFlag(ExplosionResponse.ChainReaction)) { StartCoroutine(StartChainReaction(info)); } if (HasFlag(ExplosionResponse.Destroyable)) { Destroyable breakable = GetComponent <Destroyable>(); if (breakable != null) { //Debug.Log(info.BlastStrength() + " \n" + blast + "\n"); breakable.DestroyableHit(info.BlastStrength(), blast); } } if (HasFlag(ExplosionResponse.CallScript)) { if (WhenExploded != null) { WhenExploded.Invoke(info); } //Delegate to call if (HitByExplosionDelegate != null) { HitByExplosionDelegate.Invoke(info); } } return(true); }