示例#1
0
    public void PhaseShift(int targetPlane)
    {
        shiftTimer.Reset(true);
        if (targetPlane >= 0 && targetPlane < 4)
        {
            AudioManager.Instance.MakeSource("PhaseShift").Play();

            transform.SetParent(null);

            Vector3 relativePos = Cameras[WorldIndex].transform.position - transform.position;
            //Debug.DrawLine(Cameras[targetPlane].transform.position, Cameras[targetPlane].transform.position + relativePos, Color.black, 15.0f);
            Vector3 destination = Cameras[targetPlane].transform.position - relativePos;
            transform.position = destination;

            //platChar.m_Rigidbody2D.AddForce(Vector2.right * 200f, ForceMode2D.Impulse);

            WorldIndex = targetPlane;

            if (statusEffect != 0)
            {
                ChangeStatusEffect(0);
            }

            //When the player shifts, they are temporarily invulnerable.
            SetInvulnerability(.5f);

            SetCameras();

            StartCoroutine("MicroPause", .1f);

            Debug.Log(targetPlane + " setting gscale to " + GetPlaneMechanics().gravityScale + "\n" + GetPlaneMechanics().name);
            platChar.mRigidbody2D.gravityScale = GetPlaneMechanics().gravityScale;
        }
    }
示例#2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        //If we're enabled, and we hit the player and the reset timer isn't running (which says we've hit the player recently)
        if (enabled && other.tag == "Player" && !resetTimer.Running)
        {
            GameObject go = GameObject.Instantiate(triggerParticle, transform.position, Quaternion.identity) as GameObject;

            go.transform.SetParent(transform);
            Destroy(go, 3.0f);



            if (obType == ObstacleType.Normal)
            {
                Runner.Inst.AdjustHealth(-damageAmt[(int)affiliation]);
                Runner.Inst.ChangeStatusEffect((int)affiliation + 1);

                enabled       = false;
                sRend.enabled = false;
            }
            else
            {
                Runner.Inst.AdjustHealth(-greaterDamageAmt[(int)affiliation]);
                Runner.Inst.ChangeStatusEffect((int)affiliation + 1);

                resetTimer.Reset(true);
            }
        }
    }
    void HandleInputLogic()
    {
        #region Pre-trial
        if (!started)
        {
            if (CheckInput())
            {
                Instructions.gameObject.SetActive(false);
                started = true;
                timer.Start();
            }
        }
        #endregion

        #region Running Trial
        //If we're running trials
        if (started && trialIndex < numTrials)
        {
            //If we got input
            if (CheckInput())
            {
                //If we're getting input
                if (receivingInput)
                {
                    //Set the score and reaction counter
                    score[trialIndex]       += Time.timeSinceLevelLoad - gettingInputStart;
                    reactionTime[trialIndex] = Time.timeSinceLevelLoad - gettingInputStart;

                    //We don't want to ask for input
                    PromptInput.gameObject.SetActive(false);

                    //We haven't given a blink yet
                    presentedBlinkYet = false;

                    //Reset the clock
                    timer.Reset(true);

                    //Next trial
                    trialIndex++;

                    if (trialIndex >= numTrials)
                    {
                        OutputScores();
                        running = false;
                    }
                }
                else
                {
                    //Punish the user for early input
                    score[trialIndex] += .25f;

                    //Set the timer back so they don't miss the actual input.
                    timer.AdjustTime(-.35f);
                }
            }
        }
        #endregion
    }
示例#4
0
    void Update()
    {
        kickTimer.UpdateTimer(Time.deltaTime);

        if (Input.GetKeyDown(KeyCode.Return))
        {
            KickCamera(Vector3.right, 2);
        }

        if (kicking)
        {
            if (recoiling)
            {
                if (kickTimer.Running)
                {
                    float timerPercentage = (kickTimer.counter / kickTimer.timerTargetValue);
                    //int kt = (int)(kickTimer.counter * 100);
                    //Debug.Log("Recoiling\nTimer running: " + kickTimer.counter);
                    transform.position = Vector3.Lerp(intendedPosition, kickedPosition, timerPercentage);
                }
                if (kickTimer.CheckTimer())
                {
                    transform.position = kickedPosition;

                    //Debug.Log("Recoil Complete\nTimer running: " + kickTimer.counter + "\t" + kickTimer.CheckTimer());
                    recoiling = false;
                    kickTimer.Reset(true);
                    kickTimer.Start();
                }
            }

            if (!recoiling)
            {
                if (kickTimer.Running)
                {
                    float timerPercentage = (kickTimer.counter / kickTimer.timerTargetValue);
                    transform.position = Vector3.Lerp(kickedPosition, intendedPosition, timerPercentage);
                }
                if (kickTimer.CheckTimer())
                {
                    transform.position = intendedPosition;

                    kicking = false;
                }
            }
        }
    }