protected int _timeToDie = 0; // Timer after _timeToLive goes negative before deactivation. public override void Init(IInteractionBehaviour interactionBehaviour, ActivityManager manager) { _interactionBehaviour = interactionBehaviour; _manager = manager; Revive(); _rigidbody = GetComponent<Rigidbody>(); }
public override void Init(IInteractionBehaviour interactionBehaviour, ActivityManager manager) { base.Init(interactionBehaviour, manager); bool wasSleeping = _rigidbody.IsSleeping(); //We need to do this in order to force Unity to reconsider collision callbacks for this object //Otherwise scripts added in the middle of a collision never recieve the Stay callbacks. Collider singleCollider = GetComponentInChildren <Collider>(); if (singleCollider != null) { Physics.IgnoreCollision(singleCollider, singleCollider, true); Physics.IgnoreCollision(singleCollider, singleCollider, false); } if (wasSleeping) { _rigidbody.Sleep(); } }
public override void Init(IInteractionBehaviour interactionBehaviour, ActivityManager manager) { base.Init(interactionBehaviour, manager); bool wasSleeping = _rigidbody.IsSleeping(); //We need to do this in order to force Unity to reconsider collision callbacks for this object //Otherwise scripts added in the middle of a collision never recieve the Stay callbacks. Collider singleCollider = GetComponentInChildren<Collider>(); if (singleCollider != null) { Physics.IgnoreCollision(singleCollider, singleCollider, true); Physics.IgnoreCollision(singleCollider, singleCollider, false); } if (wasSleeping) { _rigidbody.Sleep(); } }
public static int hysteresisTimeout = 5; //In fixed frames public abstract void Init(IInteractionBehaviour interactionBehaviour, ActivityManager manager);
public static int hysteresisTimeout = 5; //In fixed frames public abstract void Init(IInteractionBehaviour interactionBehaviour, ActivityManager manager);