Example #1
0
    void Start()
    {
        dropMgr = FindObjectOfType <DropManager> ();


        root = new GameObject("StairRoot");


        stairs = new List <GameObject> ();
        int totalSteps = centralStepOffset * 2;

        for (int i = 0; i < totalSteps; i++)
        {
            AddStair(i);
//			if (dropMgr.enabled) {
//				if (i > centralStepOffset-1 && i < totalSteps-1) {
//					//dropMgr.SetStair (stairs [i].transform);
//					dropMgr.SpawnRandom (stairs [i].transform.position + Vector3.up * bounds.y / 2f, i - (centralStepOffset-1));
//				}
//			}
        }
        for (int i = 1; i < centralStepOffset; i++)
        {
            dropMgr.SpawnRandom(i);
        }
        //Spawn Lock
        if (FMC_GameDataController.instance != null && !FMC_GameDataController.instance.subscriptionIsActive())
        {
            dropMgr.SpawnForced(PickableItem.Type.LOCK, 6, 6);
        }

        //Setcoinorigin ();
        dropMgr.Reattach(root);
    }
Example #2
0
    void Update()
    {
        if (ClimberStateManager.state == ClimberState.MOVING && queue.Count > 0)
        {
            timer -= Time.deltaTime;
            float t = 1 - (timer / _slideTime);

            stairCtrl.UpdateStairs(direction, moveAnimation.Evaluate(t));
            character.UpdateReturn(moveAnimation.Evaluate(t));

            camCtrl.UpdateCam(moveAnimation.Evaluate(t) * direction);


            if (timer < 0)
            {
                OnEndMove();
            }
        }

        if (ClimberStateManager.isFlying)
        {
            if (queue.Count > 0)
            {
                if (smallButton && smallButton.isShowing)
                {
                    smallButton.Hide();
                }

                timer -= Time.deltaTime;
                float t = 1 - (timer / _slideTime);

                stairCtrl.UpdateStairs(direction, t);



                if (timer < 0)
                {
                    adjustFlight = false;

                    RemoveQueue();
                    //queue.RemoveAt (0);

                    jumpCount += direction;

                    dropMgr.ShiftIndex(-1);
                    stairCtrl.SnapBack();

                    if (queue.Count == 0)
                    {
                        EndFlight();
                    }
                    else
                    {
                        timer = _slideTime;
                        //dropMgr.SpawnRandom (dropMgr.spawnPos, 7);
                        dropMgr.SpawnRandom(7, 7);
                    }
                }
            }
            else
            {
                EndFlight();
            }
        }
//		else if (ClimberStateManager.state == ClimberState.SLIDING){
//			timer -= Time.deltaTime;
//
//			float t = timer / 1;
//
//
//			if (direction < 0){
//				t = 1 - (timer / 1);
//			}
//			camCtrl.UpdateCamRaw (t);
//			if (timer < 0.15f){
//				if (direction > 0) {
//
//						//Loop ();
//					camCtrl.progress = 0.15f;
//					camCtrl.shiftCount += 1;
//					callback ();
//				}
//				else if (direction <0){
//					camCtrl.progress = 0.85f;
//					camCtrl.shiftCount -= 1;
//					callback ();
//				}
//			}
//
//
//		}

//		if (ClimberStateManager.state == ClimberState.PAUSE && (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.KeypadEnter))){
//			TogglePause ();
//		}
    }