Ejemplo n.º 1
0
 private void EndGame()
 {
     Speed = 1;
     State = AtaulfoStates.Ok;
     Oxygen = OptionsClass.AtaulfoInitialOxygen;
     Application.LoadLevel("Ranking");
 }
Ejemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        // Move Ataulfo

        bool bMoveRight = (State!= AtaulfoStates.Confused)?Input.GetKey(KeyCode.RightArrow):Input.GetKey(KeyCode.LeftArrow);
        bool bMoveLeft = (State!= AtaulfoStates.Confused)?Input.GetKey(KeyCode.LeftArrow):Input.GetKey(KeyCode.RightArrow);

        if (bMoveRight && transform.position.x<1.8f)
        {
            _Lateral= LateralSpeed;
            transform.RotateAround (new Vector3(0,-2.1f,0), Vector3.forward, _Lateral * Time.deltaTime);
        }
        if (bMoveLeft && transform.position.x>-1.8f)
        {
            _Lateral= -LateralSpeed;
            transform.RotateAround (new Vector3(0,-2.1f,0), Vector3.forward, _Lateral * Time.deltaTime);
        }

        // Reset states
        if(State != AtaulfoStates.Ok && State !=  AtaulfoStates.Dead)
        {
            _TimerState += Time.deltaTime;
            if(_TimerState > OptionsClass.TimeToResetState)
                State = AtaulfoStates.Ok;
        }

        // Ataulfo oxygen
        _TimeToNextExpire += Time.deltaTime;

        if (_TimeToNextExpire > OptionsClass.AtaulfoOxygenExpireTime)
        {
            _TimeToNextExpire-= OptionsClass.AtaulfoOxygenExpireTime;
            Oxygen--;
        }
    }