Exemplo n.º 1
0
        /// <summary>
        /// Returns the ghost from posessing whatever it is currently haunting to its true form.
        /// </summary>
        public void EndHaunt(GameObject overrideHauntedObject = null, bool useTransition = true, float transitionDuration = .55f)
        {
            if (haunted)
            {
                // store return position so we can raycast to it and make sure we don't cross any boundaries
                Vector3 destination       = haunted.GetReturnPosition();
                Vector3 returnPos         = destination;
                Vector3 destinationVector = destination - transform.position;

                RaycastHit hit;
                if (Physics.CapsuleCast(
                        transform.position,
                        transform.position + collider.height * Vector3.up,
                        collider.radius,
                        destinationVector, out hit, destinationVector.magnitude, hauntReturnColliders))
                {
                    returnPos = hit.point - destinationVector.normalized * collider.radius * 1.1f;
                }

                transform.position = GhostTools.GroundPoint(returnPos);

                if (useTransition && GhostTools.SafeToInstantiate(gameObject))
                {
                    GameObject hauntedObject = overrideHauntedObject ? overrideHauntedObject : haunted.gameObject;
                    SpawnTransitionObject(transform.position, hauntedObject, transitionDuration);
                }
                haunted.OnUnHaunted();
            }

            playMaker.FsmVariables.GetFsmFloat("transitionDuration").Value = transitionDuration + hauntTransitionOffset.Value;
            playMaker.SendEvent("endHaunt");
            haunted = null;

            burningCandles.Value = 0;
        }
Exemplo n.º 2
0
        void OnTriggerExit(Collider other)
        {
            Hauntable hauntable = other.GetComponent <Hauntable>();

            if (!hauntable)
            {
                return;
            }
        }
Exemplo n.º 3
0
        public void BeginHaunt(Hauntable newHaunted)
        {
            ResetHauntTrigger();
            haunted = newHaunted;
            playMaker.SendEvent("haunt");

            newHaunted.haunter = this;
            newHaunted.AttemptHaunt(this);
        }
Exemplo n.º 4
0
        void OnTriggerEnter(Collider other)
        {
            Hauntable hauntable = other.GetComponent <Hauntable>();

            if (!hauntable)
            {
                return;
            }
            if (!hauntable.enabled)
            {
                return;
            }
            haunter.BeginHaunt(hauntable);
        }
Exemplo n.º 5
0
 public void MigrateHaunt(Hauntable newHauntable)
 {
     BeginHaunt(newHauntable);
 }