示例#1
0
    IEnumerator FinishInteraction()
    {
        yield return(new WaitForSeconds(interactionDuration));

        Debug.Log("Leaving animation");
        interactiveObjectAnimator.Play(endAnimName);
        if (destinationPosition != null)
        {
            // attachedPlayer.GetComponent<Rigidbody2D>().MovePosition(destinationPosition.position);
            playerTransform.position = destinationPosition.position;
        }
        attachedPlayer.ReturnControlToPlayer();
        var needSys = GameObject.FindGameObjectWithTag("GameManager").GetComponent <NeedSystem>();

        needSys.Fulfill(needFulfilled, fulfillmentAmount);
        animationTriggered = false;
        attachedPlayer     = null;
        playerTransform    = null;
        Debug.Log("Control returned to Player");
        gameObject.GetComponent <InteractionLinker>().StartRespawn();
    }
示例#2
0
 void OnTriggerStay2D(Collider2D other)
 {
     if (!interactionTriggered)
     {
         var input = Input.GetAxisRaw("Vertical");
         if ((input > 0 && directionButton == ContextInputDirection.Up) ||
             (input < 0 && directionButton == ContextInputDirection.Down))
         {
             Debug.Log("Trigger activated");
             if (directionButton == ContextInputDirection.Up)
             {
                 upArrowUI.SetActive(false);
             }
             else if (directionButton == ContextInputDirection.Down)
             {
                 downArrowUI.SetActive(false);
             }
             interactionTriggered = true;
             attachedPlayer       = other.GetComponent <KittyController>();
             playerTransform      = attachedPlayer.transform;
             attachedPlayer.AutomateKitty();
         }
     }
 }
示例#3
0
 void Start()
 {
     kc = gameObject.GetComponent <KittyController>();
 }
	void Awake(){
		Debug.Log ("KittyController: AWAKE");
		instance = this;
	}