Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (TimeKeeper.GetTime() > timeToDie)
     {
         Destroy(gameObject);
     }
 }
Beispiel #2
0
 public void OnUpdate()
 {
     if (TimeKeeper.GetTime() - lastLaunch > launchDelay)
     {
         isLaunching = false;
     }
 }
Beispiel #3
0
 bool ShouldRunNext()
 {
     if (next != null && keeper.GetTime() >= next.startTime)
     {
         return(true);
     }
     return(false);
 }
 // Use this for initialization
 void Start()
 {
     alignmentPoint        = cameraTransform.position.x;
     activeFarBackgrounds  = Create(farBackground, farParallax, 50);
     activeMidBackgrounds  = Create(midBackground, midParallax, 40);
     activeNearBackgrounds = new List <ParallaxObject>();
     nextNearBackground    = TimeKeeper.GetTime() + Random.Range(nearBackgroundMin, nearBackgroundMax);
 }
 // Update is called once per frame
 void Update()
 {
     if (lever && TimeKeeper.GetTime() > resetTime)
     {
         lever = false;
         animator.SetBool("Switch", false);
     }
 }
	// Update is called once per frame
	void Update ()
    {
        OnUpdate();
        if (state == CharacterState.Idle && TimeKeeper.GetTime() > multiplierEnd)
        {
            scoreMultiplier = 1;
            multiplier.text = "";
        }
    }
 public void OnLand()
 {
     animator.SetTrigger("Land");
     state = CharacterState.Landing;
     transform.rotation = Quaternion.identity;
     rb.constraints = RigidbodyConstraints2D.FreezeRotation;
     Instantiate(smoke, new Vector3(transform.position.x, transform.position.y - .05f, transform.position.z - 1), Quaternion.Euler(0, 0, 0));
     multiplierEnd = TimeKeeper.GetTime() + 1.5f;
 }
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!lever && collision.CompareTag("Character"))
     {
         lever = true;
         animator.SetBool("Switch", true);
         resetTime = TimeKeeper.GetTime() + resetDelay;
         SoundEvents.Play("Switch");
         PotatoSwitchEvents.SwitchTriggered();
     }
 }
Beispiel #9
0
 private void SpawnPotatoIfNeeded()
 {
     if (potatoesLeft > 0 && TimeKeeper.GetTime() > nextPotato)
     {
         animator.SetTrigger("Spawn");
         SoundEvents.Play("ItemDrop");
         var newPotato = Instantiate(potatoes[3 - potatoesLeft], GetSpawnPosition(), spawnTransform.rotation);
         newPotato.velocity        = new Vector2(ConveyorSpeed.GetSpeed(), 0);
         newPotato.angularVelocity = UnityEngine.Random.Range(40, 180);
         potatoesLeft--;
         nextPotato = TimeKeeper.GetTime() + timeBetweenPotatoes;
     }
 }
 // Update is called once per frame
 void FixedUpdate()
 {
     UpdateAll();
     JumpBackgrounds(cameraTransform, activeFarBackgrounds);
     JumpBackgrounds(cameraTransform, activeMidBackgrounds);
     if (TimeKeeper.GetTime() > nextNearBackground)
     {
         var toInstantiate  = Random.Range(0, nearBackgrounds.Length);
         var nearBackground = Instantiate(nearBackgrounds[toInstantiate], new Vector3(cameraTransform.position.x + 30, cameraTransform.position.y, 30), Quaternion.identity);
         var parallax       = new ParallaxObject(nearBackground.transform, cameraTransform, nearParallax, alignmentPoint);
         activeNearBackgrounds.Add(parallax);
         nextNearBackground = TimeKeeper.GetTime() + Random.Range(nearBackgroundMin, nearBackgroundMax);
     }
 }
        internal void Extend(Interactive other, Rigidbody2D rb, Transform transform)
        {
            if (extended)
            {
                return;
            }

            extended = true;
            other.SpringLaunch(isSpring: true);
            deployState          = DeployState.Finished;
            deathTime            = TimeKeeper.GetTime() + deathDelay;
            rb.velocity          = new Vector2(extensionForceX, extensionForceY);
            transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y * 2, transform.localScale.z);
        }
    // Update is called once per frame
    void Update()
    {
        transform.position = new Vector3(cameraController.transform.position.x + offSet, transform.position.y, transform.position.z);
        if (transform.position.x > nextRoom)
        {
            nextRoom = transform.position.x + 30;
            SpawnSetPiece();
        }

        if (TimeKeeper.GetTime() > nextEnemy)
        {
            Instantiate(enemy, new Vector3(transform.position.x, transform.position.y - 10, 0), Quaternion.identity);
            nextEnemy = TimeKeeper.GetTime() + Random.Range(enemyMin, enemyMax);
        }
    }
Beispiel #13
0
 public virtual void SpringLaunch(float?x = null, float?y = null, bool isSpring = false)
 {
     if (!isLaunching)
     {
         lastLaunch  = TimeKeeper.GetTime();
         isLaunching = true;
         hasLaunched = true;
         rb.velocity = new Vector2(x ?? LaunchX + rb.velocity.x, y ?? LaunchY);
         if (isSpring)
         {
             SoundEvents.Play("Bounce");
         }
         onLaunch();
     }
 }
Beispiel #14
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (TimeKeeper.GetTime() > nextJump)
        {
            Jump();
        }
        var getGrounded = CalculateGrounded();

        if (!isGrounded)
        {
            if (getGrounded)
            {
                animator.SetTrigger("Land");
            }
        }

        isGrounded = getGrounded;
    }
 // Use this for initialization
 void Start()
 {
     nextRoom  = transform.position.x;
     offSet    = transform.position.x - cameraController.transform.position.x;
     nextEnemy = TimeKeeper.GetTime() + Random.Range(enemyMin, enemyMax);
 }
Beispiel #16
0
 private void Jump()
 {
     rb.velocity = new Vector2(0, jumpAmount);
     nextJump    = TimeKeeper.GetTime() + jumpDelay;
     animator.SetTrigger("Jump");
 }
Beispiel #17
0
 // Use this for initialization
 void Start()
 {
     nextJump = TimeKeeper.GetTime() + jumpDelay;
     rb       = GetComponent <Rigidbody2D>();
     animator = GetComponent <Animator>();
 }
Beispiel #18
0
 // Use this for initialization
 void Start()
 {
     timeToDie = TimeKeeper.GetTime() + lifetime;
 }
Beispiel #19
0
 public void SpawnPotatoes()
 {
     potatoesLeft = 3;
     nextPotato   = TimeKeeper.GetTime();
 }
 public bool Destroy()
 {
     return(deathTime.HasValue && TimeKeeper.GetTime() > deathTime);
 }