Пример #1
0
    public decimal GetTimeLeft()
    {
        if (_characterTimer == null)
        {
            _characterTimer = gameObject.AddComponent <CharacterTimer>() as CharacterTimer;
        }

        return((decimal)_characterTimer.TimeLeft);
    }
Пример #2
0
 void Start()
 {
     // Add components to character
     _characterMovement    = gameObject.AddComponent <CharacterMovement>() as CharacterMovement;
     _characterTimer       = gameObject.AddComponent <CharacterTimer>() as CharacterTimer;
     _characterInteraction = gameObject.AddComponent <CharacterInteraction>() as CharacterInteraction;
     _characterInventory   = gameObject.AddComponent <CharacterInventory>() as CharacterInventory;
     _characterDialogue    = gameObject.AddComponent <CharacterDialogue>() as CharacterDialogue;
     // Assign default values
     _characterMovement.CharacterPhysicalObject = _characterPhysicalObject;
     _characterTimer.StartTime = _startTime;
 }
Пример #3
0
 private void OnEnable()
 {
     if (_characterTimer == null)
     {
         _characterTimer = _character.GetComponent <CharacterTimer>();
     }
     if (_characterDialogue == null)
     {
         _characterDialogue = _character.GetComponent <CharacterDialogue>();
     }
     CharacterTimer.OnMileStoneReached        += ChangeMusic;
     CharacterDialogue.OnDialogueStateChanged += PlayInteractionSound;
 }
Пример #4
0
    public void ChangePausedState(bool paused)
    {
        if (_characterTimer == null)
        {
            _characterTimer = gameObject.AddComponent <CharacterTimer>() as CharacterTimer;
        }
        if (_characterMovement == null)
        {
            _characterMovement = gameObject.AddComponent <CharacterMovement>() as CharacterMovement;
        }

        if (paused)
        {
            _characterMovement.enabled = false;
            _characterMovement.SetSpeed(0);
            _characterTimer.PauseTimer();
        }
        else if (!paused)
        {
            _characterMovement.enabled = true;
            _characterTimer.ResumeTimer();
        }
    }