// Update is called once per frame
 void FixedUpdate()
 {
     if (playerManager == null)
     {
         playerManager = gm.GetPlayerManager();
     }
     if (playerManager.state == EnumPTrapezeState.InAir && currentSwipe.Count != 0 && !playerManager.HasTarget())
     {
         timer += Time.deltaTime;
         if (timer >= execTime)
         {
             ExecuteTrick();
         }
     }
     else
     {
         if (timer != 0)
         {
             timer = 0;
         }
         if (currentSwipe.Count != 0)
         {
             currentSwipe.Clear();
         }
     }
 }
 private void ResetVars()
 {
     targetNum        = 0;
     numDetected      = 0;
     targetManager    = null;
     successNode      = "";
     failNode         = "";
     targetGrabTarget = null;
     targetTrick      = "";
     detecting        = false;
 }
 // Start is called before the first frame update
 void Start()
 {
     inRange = false;
     //joint = this.gameObject.GetComponent<DistanceJoint2D>();
     //joint = inactiveObject.GetComponent<Joint2D>();
     GameManager_Trapeze.GetInstance().RegisterInteractable(gameObject.transform, this);
     //inactiveSize = gameObject.transform.localScale;
     spriteRenderer = GetComponent <SpriteRenderer>();
     //inactiveSprite = spriteRenderer.sprite;
     inactiveSpriteRenderer = inactiveObject.GetComponent <SpriteRenderer>();
     pm             = GameManager_Trapeze.GetInstance().playerAvatar.GetComponent <PlayerManager_Trapeze>();
     activeCollider = GetComponent <CircleCollider2D>();
     InRange(false);
 }
 private void SetTarget(string target)
 {
     if (target.Equals("player"))
     {
         targetManager = player;
     }
     else if (target.Equals("donna"))
     {
         targetManager = donna;
     }
     else
     {
         return;
     }
 }
Example #5
0
    public bool AttachToInitial()
    {
        if (initGrabTarget.joint.connectedBody != null)
        {
            PlayerManager_Trapeze pm = initGrabTarget.joint.connectedBody.gameObject.GetComponentInParent <PlayerManager_Trapeze>();
            if (pm.facingRight != facingRight)
            {
                return(AttachTo(pm.legGrabTarget));
            }
            return(AttachTo(pm.legGrabTarget, false));
        }
        bool turn = true;

        if (lastGrabTarget != initGrabTarget && facingRight == initFacingRight)
        {
            turn = false;
        }
        return(AttachTo(initGrabTarget, turn));
    }
    void Start()
    {
        donnaManager.gameObject.SetActive(duoTrapeze);
        if (gradedPerformance)
        {
            timerText.gameObject.SetActive(true);
            exitBtn.SetActive(false);
        }
        duoTrapeze = false;
        TouchInputManager t = TouchInputManager.getInstance();

        if (t == null)
        {
            Destroy(this);
        }
        trickGUI = TrickGUI.GetInstance();
        t.SubscribeTapListener(this, 0);
        t.SubscribeSwipeListener(this, 0);
        if (playerAvatar == null)
        {
            Debug.Log("Player Avatar is null");
            Destroy(this);
        }
        pmt = playerAvatar.GetComponent <PlayerManager_Trapeze>();
        if (pmt == null)
        {
            Debug.Log("Player Avatar is missing PlayerManager_Trapeze script");
            Destroy(this);
        }
        if (scriptToLoad != null)
        {
            dialogueRunner.Add(scriptToLoad);
        }
        if (canTutorial)
        {
            tutorialManager.SetActive(true);
        }
    }