Beispiel #1
0
    public void Update(float deltaSeconds)
    {
        if (myState == JackState.DEAD)
        {
            return;
        }

        if (myState == JackState.REELING)
        {
            reelingTimeRemaining -= deltaSeconds;

            if (reelingTimeRemaining <= 0.0f)
            {
                myState = JackState.OK;
            }
        }

        textDisplayElapsedSeconds += deltaSeconds;

        if (textDisplayElapsedSeconds < textDisplayStartTime)
        {
            textDisplayScrollPosition = 0;
        }
        else
        {
            float scrollTime     = textDisplayElapsedSeconds - textDisplayStartTime;
            float scrolledPixels = scrollTime * textDisplayScrollSpeed;
            textDisplayScrollPosition = Mathf.FloorToInt(scrolledPixels);
        }

        MoveJack(deltaSeconds);

        if (!SwordSwinging)
        {
            if (Input.GetButtonDown("Fire1"))
            {
                SwordSwinging    = true;
                swingElapsedTime = 0.0f;
                swingIndex       = Random.Range(0, Swings.Count);
            }
        }
        else
        {
            swingElapsedTime += deltaSeconds;
            MoveSword();
            CheckSwordHit();
            RecordSwordFrame();
            if (CheckSwingDone())
            {
                SwordSwinging = false;
            }
        }
        PurgeSwordFrames();
    }
Beispiel #2
0
 public void Hit()
 {
     hitPoints--;
     if (hitPoints == 0)
     {
         myState = JackState.DEAD;
         return;
     }
     else
     {
         myState = JackState.REELING;
         reelingTimeRemaining = MAX_REEL_DURATION;
     }
 }
 public void setCurrentJackState(JackState state)
 {
     CurrentJackState = state;
     Debug.WriteLine("set jackstate = " + state);
 }
Beispiel #4
0
 public void setCurrentJackState(JackState state)
 {
     CurrentJackState = state;
     Debug.WriteLine("set jackstate = " + state);
 }
Beispiel #5
0
        public void Initialize()
        {
            CurrentState = CarState.NotInWorld;
            PreviousState = CarState.NotInWorld;

            CurrentJackState = JackState.NotJacking;
            PreviousJackState = JackState.NotJacking;

            InTransition = false;
            BetweenCones = false;
            PreviousBetweenCones = false;
            Fueling = false;
            Repairing = false;
            FuelLevel = 0;
            PreviousFuelLevel = 0;
            LiftTimer = DateTime.Now;
            DropTimer = DateTime.Now;
            DropTime = DateTime.Now;
            FuelTimer = DateTime.Now;
            LiftCounter = 0;
        }