Пример #1
0
    protected IEnumerator OpenDoor(AbstractEntity argEntity)
    {
        // Activate Door
        StartCoroutine(argEntity.Activate(Speaker));

        // Target No Longet Needed
        Target = null;

        //// Wait Till Out of View
        //while (FindTarget() == argEntity)
        //    yield return new WaitForFixedUpdate();

        StartCoroutine(PowerOff(argEntity));
        yield return new WaitForFixedUpdate();
    }
Пример #2
0
    protected IEnumerator StartClimbing(AbstractEntity argEntity)
    {
        StartCoroutine(argEntity.Activate(Speaker));

        GetComponent<ThirdPersonController>().enabled = false;

        animation[AnimationResources.Climb].speed = 1.5f;
        GameObject.animation.CrossFade(AnimationResources.Climb);

        GetComponent<ThirdPersonController>()._Gravity = 0;
        GetComponent<ThirdPersonController>().MoveSpeed = 0;
        climbCheck = true;

        yield return new WaitForFixedUpdate();
    }
Пример #3
0
    public IEnumerator StartConversation(AbstractEntity argEntity)
    {
        if (argEntity is Speaker)
        {
            yield return StartCoroutine(argEntity.Activate(Speaker));

            // Disable Controllers
            if(ThirdPersonController != null)
                ThirdPersonController.enabled = false;

            ThirdPersonCamera.offset += new Vector3(1, 1, 0) * 0.25f;
            ThirdPersonCamera.distance -= 0.5f;
            ThirdPersonCamera.height += 0.5f;

            StartCoroutine(argEntity.RotateTowards(Speaker.Transform.position - argEntity.Transform.position, 2));
            StartCoroutine(Speaker.RotateTowards(argEntity.Transform.position - Speaker.Transform.position, 2));

            // Execute Commands
            Dialogue dialogue = (argEntity as Speaker).GetDialogue(Speaker);
            yield return StartCoroutine(Read(dialogue));
        }
    }
Пример #4
0
    protected IEnumerator PickupItem(AbstractEntity argEntity)
    {
        StartCoroutine(argEntity.Activate(Speaker));

        CarryTransform = Actor.GetComponent<AbstractAnimal>() != null ? Actor.Mouth : Actor.LeftHand;
        argEntity.Transform.parent = CarryTransform;
        argEntity.Transform.position = CarryTransform.position;

        argEntity.rigidbody.useGravity = false;
        argEntity.rigidbody.isKinematic = true;
        argEntity.collider.isTrigger = true;
        yield return new WaitForSeconds(1);
    }
Пример #5
0
    private IEnumerator PossessLiving(AbstractEntity argEntity)
    {
        StartCoroutine(argEntity.Activate(Speaker));

        /// Disable Control
        //        Ghost.DisablePlayerControl();
        Ghost.ThirdPersonController.enabled = false;

        if (argEntity is HumanScript)
            (argEntity as HumanScript).HideMood();

        /// Animate Rotation
        StartCoroutine(argEntity.RotateTowards(Ghost.Transform.position - argEntity.Transform.position, 2));
        StartCoroutine(Ghost.RotateTowards(argEntity.Transform.position - Ghost.Transform.position, 2));

        //TODO: REMOVE, SHORTCUT
        if (Input.GetKey(KeyCode.Tab))
        {
            // Animate Pull
            yield return new WaitForSeconds(0.3f); // Wait for Rotation Complete
            Ghost.animation.CrossFade(AnimationResources.PossWrongInput);

            //TODO: DROP ROPES HERE

            // Rotate Target
            yield return new WaitForSeconds(0.3f);
            argEntity.animation.CrossFade(AnimationResources.PossComplete);
            yield return new WaitForSeconds(0.1f);
            yield return StartCoroutine(Target.RotateTowards(Ghost.Transform.position - Target.Transform.position, 2));

            // Move Back
        //            yield return StartCoroutine(Ghost.MoveTo(Ghost.Transform.position - (Ghost.Transform.forward * 0.3f) + (Ghost.Transform.up * 0.3f), 1));

            // Jump Into Target
            Ghost.Animation.CrossFade(AnimationResources.PossComplete);
            //argEntity.animation.CrossFade(AnimationResources.PossComplete);
        }
        else
            yield return StartCoroutine(PossessionStruggle(argEntity as AbstractLivingBeing));
    }