Пример #1
0
 public void Start()
 {
     Game.Instance.Register(this);
     spawnTimer          = new BasicTimer(spawnInterval, true);
     spawnTimer.Duration = spawnInterval * UnityEngine.Random.Range(0.5f, 2f);
     spawnTimer.Reset();
 }
Пример #2
0
    public static BasicTimer SetupTimer(GameObject attachTo, float cycleTime, bool setPassive = false, float startTimerAt = 0f, bool startCycled = false)
    {
        if (cycleTime > 0)
        {
            BasicTimer newTimer = attachTo.AddComponent <BasicTimer> () as BasicTimer;
            newTimer.cycleInterval = cycleTime;
            newTimer.passiveTimer  = setPassive;
            newTimer.counter       = startTimerAt;
            if (startCycled)
            {
                newTimer.timesCycled = 1;
            }

            return(newTimer);
        }
        else if (cycleTime == 0)
        {
            Debug.Log("Error: invalid input. BasicTimer was passed 0 for cycle time.");
        }
        else
        {
            Debug.Log("Error: invalid input. BasicTimer was passed a negative value for cycle time.");
        }
        return(null);
    }
Пример #3
0
    //public

    // Use this for initialization
    void Start()
    {
        uiEngine        = GameObject.Find("UIMaster").GetComponent <UIEngine> ();
        narrativeEngine = GameObject.Find("NarrativeMaster").GetComponent <NarrativeEngine> ();
        objectiveTimer  = new BasicTimer(0);
        transitionTimer = new BasicTimer(0);
    }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     Debug.Log(narrativeManager.narrativeFullList.Count + " elements in the list");
     timerToUse = new BasicTimer(0);
     goTimer    = true;
     //narrativeManager.ListAllNarrativeKeys ();
 }
Пример #5
0
 public void Setup(ControllerBinding binding, int remaining, float period, float offset)
 {
     this.binding    = binding;
     this.remaining  = remaining;
     this.spawnTimer = new BasicTimer(period);
     this.spawnTimer.ShiftOnce(offset);
 }
Пример #6
0
    void OnLaunch()
    {
        thisBody.Cycle();
        Glue(GlueState.FREE);

        //test
        //thisTransform.position = thisTransform.position + Vector3.one*10f;
        thisRigidbody.AddForce(nextForce);

        expireTimer = new BasicTimer(1.5f, false);
    }
Пример #7
0
 override protected void Awake()
 {
     base.Awake();
     //objectCollider = transform.parent.GetComponent<BoxCollider>();
     playerValues         = GetComponent <PlayerValues>();
     countdown            = dashCooldown;
     DashCooldownTimer    = new BasicTimer(dashCooldown);
     DashDurationTimer    = new BasicTimer(dashDuration);
     IsWithinTriggerRange = false;
     DashLevel            = 1;
 }
 // Update is called once per frame
 void Update()
 {
     if (myTimer != null)
     {
         if (myTimer.Update())             //update returns true when it's finished!
         // Alternative to the OnFinished callback
         {
             myTimer = null;
         }
     }
 }
Пример #9
0
    public override void Enter()
    {
        owner.reloadMeter.gameObject.SetActive(true);
        //reloadMeterBack = owner.reloadMeter.transform.GetComponentInChildren<Image>(true);
        reloadHolder    = owner.reloadMeter.transform.Find("ReloadMeterBack").gameObject;
        reloadMeterBack = reloadHolder.GetComponent <Image>();

        timer = new BasicTimer(reloadTime);
        owner.renderColor.material.color = Color.blue;
        owner.agnes.isStopped            = true;
        EventSystem.Current.FireEvent(new PlaySoundEvent(owner.transform.position, owner.ReloadSound, 1f, 1f, 1f));
    }
Пример #10
0
    public virtual void PlayerDash(Vector3 velocity, bool useKnockback = true)
    {
        if (Gracetimer == null)
        {
            CurrentToughness -= 1;

            knockbackDirection = velocity.normalized;
            agnes.velocity     = knockbackDirection.normalized * (5f + velocity.magnitude);
            //Sets to false in stun leave -> changed to stun enter().

            Gracetimer = new BasicTimer(graceTime);
            float knockbackTimerDuration = 0f;

            if (useKnockback)
            {
                DoingKnockback         = true;
                knockbackTimerDuration = 0.5f;
            }
            timer = new BasicTimer(knockbackTimerDuration);


            if (CurrentToughness <= 0)
            {
                if (healthMeter != null && healthMeterBackground != null)
                {
                    healthMeter.enabled           = false;
                    healthMeterBackground.enabled = false;
                }
                EventSystem.Current.FireEvent(new EnemyDieEvent("Bonde died", gameObject));
                int   randomNr = Random.Range(0, deathScreams.Length - 1);
                float volume   = 1f;
                if (randomNr == 2)
                {
                    volume = 0.3f;
                }

                if (deathScreams.Length > 0)
                {
                    EventSystem.Current.FireEvent(new PlaySoundEvent(transform.position, deathScreams[randomNr], volume, 0.9f, 1.1f));
                }
            }
            else
            {
                EventSystem.Current.FireEvent(new PlaySoundEvent(transform.position, hitSound, 0.6f, 0.9f, 1.3f));
            }

            if (healthMeter != null)
            {
                healthMeter.fillAmount = CurrentToughness / toughness;
            }
        }
    }
Пример #11
0
    void Awake()
    {
        posOffset.z = transform.position.z - transform.parent.position.z;


        creepyShakeInterval = creepyShakePeriodInterval / 3;

        creepyShakeWhenTimer   = BasicTimer.SetupTimer(gameObject, creepyShakeAfter, false, 0f, true);
        creepyShakePeriodTimer = BasicTimer.SetupTimer(gameObject, creepyShakePeriodInterval);
        creepyShakeTimer       = BasicTimer.SetupTimer(gameObject, creepyShakeInterval);

        shakeSpeed         = creepyShakeInterval / 2;
        shakeSpeedVariance = shakeSpeed;
    }
Пример #12
0
    public void Open()
    {
        isCurrentlyAnimating = true;
        IsOpened             = true;

        if (GameManager.instance.player.IsDashing && GameManager.instance.player.HasDashSpeed)
        {
            animationTimer = new BasicTimer(0.2f);
        }
        else
        {
            animationTimer = new BasicTimer(2f);
        }
        GetComponent <Collider>().enabled = false;
    }
Пример #13
0
    // Update is called once per frame
    public override void Update()
    {
        if (isPaused)
        {
            return;
        }

        //while timer is tickinh, peasant cant take dmg
        if (Gracetimer != null && Gracetimer.IsCompleted(Time.deltaTime, false, true))
        {
            Gracetimer = null;
        }


        if (timer != null && timer.IsCompleted(Time.deltaTime, false, true))
        {
            timer = null;
            if (CurrentToughness <= 0f)
            {
                isDying          = true;
                CurrentToughness = toughness; // lives are reset.
                agnes.velocity   = Vector3.zero;
            }
            else
            {
                DoingKnockback = false;
                agnes.velocity = Vector3.zero;
            }

            return;
        }
        else
        {
            if (DoingKnockback)
            {
                agnes.velocity -= knockbackDirection * Time.deltaTime;
            }
        }

        if (agnes.velocity.magnitude > 20f)
        {
            agnes.velocity = Vector3.ClampMagnitude(agnes.velocity, 20f);
        }

        base.Update();
    }
Пример #14
0
 public virtual void PlayerInteraction()
 {
     if (playerIsInteracting == false)
     {
         if (audioSource != null)
         {
             audioSource.PlayOneShot(interactionSound);
         }
         UIManager.instance.ShowInteractionMeter(interactionDuration);
         playerIsInteracting = true;
         interactionTimer    = new BasicTimer(interactionDuration);
         GameManager.instance.player.canTakeInput = false;
         //start eating
         GameManager.instance.player.anim.SetTrigger("IsStartingToEatTrigger");
         GameManager.instance.player.anim.ResetTrigger("IsFinishingEatingTrigger");
     }
 }
Пример #15
0
    public override void Configure()
    {
        base.Configure();
        stomachPeriod = acfg.stomachPeriod;
        if (stomachPeriod > 0.01f)
        {
            stomachTimer = new BasicTimer(acfg.stomachPeriod);
        }
        stomachCapacity = acfg.stomachCapacity;
        ad.stomach      = acfg.stomachCapacity;

        float biteTimerPeriod = 8f;//acfg.biteTimerPeriod;

        if (biteTimerPeriod > 0.01f)
        {
            biteTimer = new BasicTimer(biteTimerPeriod);
        }
    }
Пример #16
0
    public void AdvanceThrow()
    {
        switch (throwPhase)
        {
        case ThrowPhase.NONE:
            if (body.CanThrowStart())
            {
                throwTimer = new BasicTimer(1f, false);
                body.AlignToThrower();
                throwPhase = ThrowPhase.ALIGN;
            }
            else
            {
                TryCycle();
            }
            break;

        case ThrowPhase.ALIGN:
            throwTimer = new BasicTimer(3f, false);
            body.Animate();
            throwPhase = ThrowPhase.CHARGE;
            break;

        case ThrowPhase.CHARGE:
            if (body.CanThrowFinish())
            {
                body.Launch(1f - throwTimer.Percent);
                throwTimer = new BasicTimer(0.5f, false);
                throwPhase = ThrowPhase.COOLDOWN;
            }
            break;

        case ThrowPhase.COOLDOWN:
            throwTimer.Pause(true);
            throwPhase = ThrowPhase.NONE;
            break;

        default:
            break;
        }
    }
Пример #17
0
    public void GetCrushed()
    {
        if (Gracetimer == null)
        {
            CurrentToughness -= 1;
            Gracetimer        = new BasicTimer(graceTime);
            if (CurrentToughness <= 0)
            {
                if (healthMeter != null && healthMeterBackground != null)
                {
                    healthMeter.enabled           = false;
                    healthMeterBackground.enabled = false;
                }
                isDying = true;
                EventSystem.Current.FireEvent(new PlaySoundEvent(transform.position, hitSound, 0.6f, 0.9f, 1.3f));
                EventSystem.Current.FireEvent(new EnemyDieEvent("Bonde died", gameObject));
            }

            else if (CurrentToughness >= 1 && healthMeter != null)
            {
                healthMeter.fillAmount = CurrentToughness / toughness;
            }
        }
    }
Пример #18
0
 // Start is called before the first frame update
 void Start()
 {
     controllerTimer         = new BasicTimer(moveCooldown);
     originalColor           = buttons[currentlyChosenMenuItem].GetComponent <Image>().color;
     currentlyChosenMenuItem = -1;
 }
Пример #19
0
 // Use this for initialization
 void Start()
 {
     timerToUse = new BasicTimer(0f);
     narrativeManager.ListAllNarrativeKeys();
 }
Пример #20
0
 void Start()
 {
     respawnTimer = new BasicTimer(5);
 }
Пример #21
0
    //public bool startObjectiveText2 = false;

    // Use this for initialization
    void Start()
    {
        timerToUse = new BasicTimer(0);
    }
Пример #22
0
 public BasicTimerTest()
 {
     DefaultMonitorRegistry.Instance.Clear();
     timer = new BasicTimer(MonitorConfig.Build("Test"));
 }
Пример #23
0
 public AmmoSupplyLogic(List <BattleSideEnum> sideList)
 {
     this._sideList   = sideList;
     this._checkTimer = new BasicTimer(MBCommon.TimeType.Mission);
 }
 void Start()
 {
     timer = new BasicTimer(0);
 }
 // Use this for initialization
 void Start()
 {
     myTimer = new BasicTimer();
     myTimer.Start();
 }
 void Start()
 {
     durationMeter            = GetComponent <Image>();
     durationMeter.fillAmount = 0;
     duration = new BasicTimer(interactionDuration);
 }