Example #1
0
    // check answer
    private IEnumerator _checkwait(float timeshow, float timeguess)
    {
        yield return(new WaitForSeconds(timeshow));

        //Debug.Log("ah");
        FunctionTimer.Create(CheckNumbers, timeguess);
    }
Example #2
0
    private void Move()
    {
        var x = DMath.Random(_minRotation.x, _maxRotation.x);
        var y = DMath.Random(_minRotation.y, _maxRotation.y);
        var z = DMath.Random(_minRotation.z, _maxRotation.z);
        var desiredRotation = new Vector3(x, y, z);

        float duration = DMath.Random(_duration);

        if (IsPanic)
        {
            duration /= _panicSpeedUpFactor;
        }

        transform.DORotate(desiredRotation, duration).SetEase(Ease.InOutSine);

        float delay = DMath.Random(_delay);

        if (IsPanic)
        {
            delay /= _panicSpeedUpFactor;
        }

        FunctionTimer.Create(Move, delay);
    }
Example #3
0
    void Start()
    {
        if (gm == null)
        {
            gm = gameObject.GetComponent <GameManager>();
        }

        if (player == null)
        {
            player = GameObject.FindWithTag("Player");
        }

        if (canBeatLevel == true)
        {
            Time.timeScale = 0.5f;
            FunctionTimer.Create(() => TargetScoreDisplay.enabled = false, 2f);
            FunctionTimer.Create(() => Time.timeScale             = 1, 2f);
        }
        playerHealth = player.GetComponent <Health>();

        // setup score display
        Collect(0);

        // make other UI inactive
        gameOverCanvas.SetActive(false);
        if (canBeatLevel)
        {
            beatLevelCanvas.SetActive(false);
        }
    }
Example #4
0
 private void SixthPhaseStart()
 {
     //going to 0 wind speed
     FunctionTimer.Create(() => WindController.Instance.ChangeState(1), 0.5f, currentTutorialPhase.ToString());;
     FunctionTimer.Create(ShowTutorialTextBox, 3f, currentTutorialPhase.ToString());
     FunctionTimer.Create(AdvanceTutorialPhase, 8f, currentTutorialPhase.ToString());
 }
Example #5
0
 public void ExecuteAction()
 {
     ChatBubble.Create(gameObject.transform, new Vector3(1f, 1.7f), ChatBubble.IconType.Happy, text);
     FunctionTimer.Create(() => {
         onChatBubbleComplete.ExecuteAction();
     }, 2f);
 }
Example #6
0
 private void ThirdPhaseStart()
 {
     FunctionTimer.Create(ShowTutorialTextBox, 1f, currentTutorialPhase.ToString());
     //FunctionTimer.Create(() => tutorialFuelTankMarker.GetComponent<FadeInOut>().FadeIn(), 1f, currentTutorialPhase.ToString());
     //FunctionTimer.Create(() => tutorialFuelTankMarker.GetComponent<FadeInOut>().FadeOut(), 7f, currentTutorialPhase.ToString());
     FunctionTimer.Create(AdvanceTutorialPhase, 8f, currentTutorialPhase.ToString());
 }
 public override void Update()
 {
     if (CanBeseen())
     {
         nextState = new NpcHide(npc, agent, anim);
         stage     = EVENT.EXIT;
     }
     agent.SetDestination(safe.transform.position);
     if (agent.remainingDistance <= agent.stoppingDistance)
     {
         anim.SetTrigger("isIdle");
         agent.isStopped = true;
         if (look)
         {
             npc.transform.LookAt(target.transform.position);
         }
         if (activated)
         {
             FunctionTimer.Create(() => nextState = new NpcScout(npc, agent, anim), 5f);
             FunctionTimer.Create(() => stage     = EVENT.EXIT, 5f);
             activated = false;
         }
         else
         {
             base.Update();
         }
     }
 }
Example #8
0
 public void SpawnSmoke(Vector3 position, float timer, Vector3 localScale)
 {
     FunctionTimer.Create(() => {
         Transform smokeTransform  = UnityEngine.Object.Instantiate(GameAssets.i.pfSmokePuff, position, Quaternion.identity);
         smokeTransform.localScale = localScale;
     }, timer);
 }
Example #9
0
    private void HandleGridMovement()
    {
        gridMoveTimer += Time.deltaTime;

        if (gridMoveTimer >= gridMoveTimerMax)
        {
            gridMoveTimer -= gridMoveTimerMax;

            snakeMovePositionList.Insert(0, gridPosition);

            gridPosition += gridMoveDirection;

            // bool snakeAteFood = levelGrid.TrySnakeEatFood (gridPosition);
            // if (snakeAteFood) {
            //     snakeBodySize++;
            //   CreateSnakeBody();

            // }

            if (snakeMovePositionList.Count >= snakeBodySize + 1)
            {
                snakeMovePositionList.RemoveAt(snakeMovePositionList.Count - 1);
            }

            for (int i = 0; i < snakeMovePositionList.Count; i++)
            {
                Vector2Int   snakeMovePosition = snakeMovePositionList[i];
                World_Sprite worldSprite       = World_Sprite.Create(new Vector3(snakeMovePosition.x, snakeMovePosition.y), Vector3.one * .5f, Color.white);
                FunctionTimer.Create(worldSprite.DestroySelf, gridMoveTimerMax);
            }
            transform.position    = new Vector3(gridPosition.x, gridPosition.y);
            transform.eulerAngles = new Vector3(0, 0, GetAngleFromVector(gridMoveDirection) - 90);
        }
    }
Example #10
0
    void Blst()
    {
        //if (Input.GetKey(KeyCode.Space) && !activated  && refill)
        if (CrossPlatformInputManager.GetButton("Jump") && !activated && refill)
        {
            activated = true;
            ball.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezePosition;
            ball.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
            Blast.transform.rotation = Quaternion.Euler(blastpos);
            Blast.Play();

            Refill();

            enemies = Physics.OverlapSphere(ball.transform.position, explosionradius);
            foreach (Collider i in enemies)
            {
                if (i.tag == "Enemies")
                {
                    Vector3 oppdir = (i.transform.position - ball.transform.position);
                    float   dist   = Vector3.Distance(ball.transform.position, i.transform.position);
                    dist = 10 - dist;
                    i.attachedRigidbody.AddForce(oppdir * 30 * dist);
                }
            }
            FunctionTimer.Create(() => ball.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None, 1f);
            FunctionTimer.Create(() => Blast.Stop(), timer);
            FunctionTimer.Create(() => Blast.Clear(), timer);
            FunctionTimer.Create(() => activated = false, timer);
        }
    }
Example #11
0
    public void BoostHandlePulled()
    {
        if (!ShipSpeedController.Instance.IsBoosting && IsBoostAvailable())
        {
            if (boostPercentage >= GlobalGameplayVariables.Instance.BoostThreshold)
            {
                //TODO: make this an additive thing like tweening
                FunctionTimer.Create(() => StartCoroutine(CameraShake.Instance.Shake(1f, 0.02f)), 0f);
                FunctionTimer.Create(() => StartCoroutine(CameraShake.Instance.Shake(1.6f, 0.4f)), 1f);
                FunctionTimer.Create(() => StartCoroutine(CameraShake.Instance.Shake(3.4f, 0.08f)), 2.6f);
                FunctionTimer.Create(() => StartCoroutine(CameraShake.Instance.Shake(5f, 0.04f)), 6f);

                //Handheld.Vibrate();

                //DashboardManager.Instance.TurnOffDashboard();
                DashboardManager.Instance.TurnOffBoostPullie();
                SoundManager.Instance.PlaySoundEffect(SoundManager.SoundEffect.Dashboard_Boost);
                ShipSpeedController.Instance.StartBoosting();
            }

            //TODO: animate emptying...
            //TODO: sound of negative feedback if the handle was used when tank not critical:
            boostPercentage = 0;
        }
    }
Example #12
0
 private void SecondPhaseStart()
 {
     FunctionTimer.Create(ShowTutorialTextBox, 1f, currentTutorialPhase.ToString());
     FunctionTimer.Create(() => ShowTutorialMarker(TutorialMarker.MarkerAnimation.SwipeDown), 1f, currentTutorialPhase.ToString());
     FunctionTimer.Create(() => EnableCooling = true, 1f, currentTutorialPhase.ToString());
     secondPhaseTimer = 3f; //TODO: test
 }
Example #13
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("HurtBox"))
     {
         FunctionTimer.Create(() => Destroy(this.gameObject), 1f);
     }
 }
Example #14
0
    public void startDeath()
    {
        anim.SetBool("playerDead", true);

        pc.playerCanMove = false;

        FunctionTimer.Create(endDeathAction, 3f);
    }
    private void Start()
    {
        FunctionTimer.Create(() => { entranceDoorAnims.SetColor(DoorAnims.ColorName.Green); }, 3.0f);
        FunctionTimer.Create(() => { entranceDoorAnims.OpenDoor(); }, 3.5f);

        CinematicBars.Show_Static(150f, .01f);
        FunctionTimer.Create(() => { CinematicBars.Show_Static(0f, .5f); }, 3f);
    }
    public void ScreenShake()
    {
        CinemachineBasicMultiChannelPerlin cinemachineBasicMultiChannelPerlin = cinemachineVirtualCamera.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>();

        cinemachineBasicMultiChannelPerlin.m_AmplitudeGain = 1f;

        FunctionTimer.Create(() => { cinemachineBasicMultiChannelPerlin.m_AmplitudeGain = 0f; }, .1f);
    }
Example #17
0
 public void ResetWithDelay()
 {
     isReseting         = true;
     speed              = minSpeed;
     transform.position = original_pos;
     rb.velocity        = Vector2.zero;
     FunctionTimer.Create(ResetBall, 2f);
 }
Example #18
0
    public void Restart()
    {
        //fade out
        faderAnimator.SetBool("Fade", true);

        //restart
        FunctionTimer.Create(() => FlowardSceneManager.Instance.LoadFloawardScene(FlowardScene.Gameplay), 1f);
    }
Example #19
0
 private void FifthPhaseUpdate()
 {
     if (!PhaseEndConditionMet && SailsController.Instance.State == SailsState.SailsDown)
     {
         PhaseEndConditionMet = true;
         FunctionTimer.Create(AdvanceTutorialPhase, 3f, currentTutorialPhase.ToString());
     }
 }
Example #20
0
 private void FourthPhaseStart()
 {
     //going to 2 wind speed
     FunctionTimer.Create(() => WindController.Instance.ChangeState(2), 0.5f, currentTutorialPhase.ToString());;
     FunctionTimer.Create(() => EnableSailsUp = true, 3f, currentTutorialPhase.ToString());
     FunctionTimer.Create(ShowTutorialTextBox, 3f, currentTutorialPhase.ToString());
     FunctionTimer.Create(() => ShowTutorialMarker(TutorialMarker.MarkerAnimation.SwipeLeft), 3f, currentTutorialPhase.ToString());
 }
Example #21
0
 private void FifthPhaseStart()
 {
     //going to -1 wind
     FunctionTimer.Create(() => WindController.Instance.ChangeState(-3), 0.5f, currentTutorialPhase.ToString());;
     FunctionTimer.Create(() => EnableSailsDown = true, 3f, currentTutorialPhase.ToString());
     FunctionTimer.Create(ShowTutorialTextBox, 3f, currentTutorialPhase.ToString());
     FunctionTimer.Create(() => ShowTutorialMarker(TutorialMarker.MarkerAnimation.SwipeRight), 3f, currentTutorialPhase.ToString());
 }
Example #22
0
 private void FirstPhaseUpdate()
 {
     if (!PhaseEndConditionMet && EngineController.Instance.HeatLevel > 90)
     {
         PhaseEndConditionMet = true;
         FunctionTimer.Create(AdvanceTutorialPhase, 3f, currentTutorialPhase.ToString());
     }
 }
Example #23
0
        private void FocusGameView(bool state)
        {
            var profileHub = gameObject.FindOrCreate <PostProcessingProfileHub>();

            profileHub.Current = state ? _focusedPP : _defaultPP;

            FunctionTimer.Create(() => SwitchCanvases(state), .5f);
            _playerRenderer.gameObject.SetActive(!state);
        }
 private void EnemySpawner_OnPlayerTriggerEnter2D(object sender, System.EventArgs e)
 {
     FunctionTimer.Create(SpawnEnemy, .1f);
     FunctionTimer.Create(SpawnEnemy, .3f);
     FunctionTimer.Create(SpawnEnemy, .6f);
     FunctionTimer.Create(SpawnEnemy, .8f);
     FunctionTimer.Create(SpawnEnemy, 1.1f);
     FunctionTimer.Create(SpawnEnemy, 1.5f);
 }
Example #25
0
    public void StartGameOverSequence()
    {
        //TODO: save hiscore to player prefs (https://docs.unity3d.com/ScriptReference/PlayerPrefs.html)
        //TODO: OR - use https://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html to encrypt it so its unexploitable

        PlayerPrefs.SetInt("current_score", (int)ShipSpeedController.Instance.miles);

        faderAnimator.SetBool("Fade", true);
        FunctionTimer.Create(() => FlowardSceneManager.Instance.LoadFloawardScene(FlowardScene.Score), 1f);
    }
    public override void Enter()
    {
        Debug.Log("Kill");

        anim.SetTrigger("UpperCut");
        base.Enter();

        FunctionTimer.Create(() => nextState = new NpcApproach(npc, agent, anim), 4f);
        FunctionTimer.Create(() => stage     = EVENT.EXIT, 4f);
    }
 private void Start()
 {
     if (GameData.state == GameData.State.Start)
     {
         FunctionTimer.Create(() => {
             Show();
         }, 1f);
     }
     Hide();
 }
 public void CinematicLookDown(float timer)
 {
     state = State.Busy;
     rigidbody3D.velocity = Vector3.zero;
     //characterBase.GetUnitAnimation().PlayAnimForced(UnitAnimType.GetUnitAnimType(""), new Vector3(0, -1), 1f, null, null, null);
     characterBase.GetUnitAnimation().PlayAnimForced(UnitAnim.GetUnitAnim("dBareHands_Victory"), 1f, null, null, null);
     FunctionTimer.Create(() => {
         state = State.Normal;
     }, timer);
 }
 //since time is frozen during dialogue, and the trigger is destroyed, the OnTriggerStay method is needed to do stuff after dialogue
 private void OnTriggerStay(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         door.GetComponent <Animator>().enabled = true;
         sun.gameObject.SetActive(true);
         Destroy(sphereLight);
         FunctionTimer.Create(PlayDoorSound, 0.8f);
     }
 }
Example #30
0
        private void EndBattle()
        {
            if (doorAnims != null)
            {
                doorAnims.SetColor(DoorAnims.ColorName.Green);
                FunctionTimer.Create(doorAnims.OpenDoor, 1.5f);
            }

            OnBattleEnded?.Invoke(this, EventArgs.Empty);
        }