// Active function public void PowerupEffect() { while (Running) // Runs on state activation { player.GetComponent <Health>().hp = 1; player.GetComponent <Health>().CanDie = true; player.GetComponent <Weapon>().CanFire = false; player.GetComponent <Transform>().localScale = new Vector2(1, 1); Running = false; } }
public void ToPlayerBounceState() { Debug.Log("player is now in bounce state"); player.collided = false; player.GetComponent <CapsuleCollider>().material.bounciness = 1f; player.currentState = player.bounceState; }
public void ToPlayerBounceState() { Debug.Log("player is now in bounce state"); player.collided = false; player.GetComponent <CapsuleCollider> ().material.bounciness = 1f; player.transform.localScale += (Vector3.up * 0.5f); player.distToGround += 0.5f; player.currentState = player.bounceState; }
// Active function public void PowerupEffect() { while (running) // Runs once on state activation { Transform pTransform = player.GetComponent <Transform>(); pTransform.localScale = new Vector2(pTransform.localScale.x, pTransform.localScale.y) * 1.5f; player.GetComponent <Health>().hp = 2; ps = GameObject.Instantiate(player.BigPlayerEffect, player.transform.position, Quaternion.identity); running = false; } ps.transform.position = player.transform.position; if (player.GetComponent <Health>().hp == 1) // Exit condition { ToNormalPlayer(); running = true; GameObject.Destroy(ps); } }
// Active function public void PowerupEffect() { powerupTimer += Time.deltaTime; while (running) // Runs once on state activation { player.GetComponent <Weapon>().CanFire = true; ps = GameObject.Instantiate(player.CanShootEffect, player.transform.position, Quaternion.identity); running = false; } ps.transform.position = player.transform.position; if (powerupTimer > powerupLength) // Exit conditions { ToNormalPlayer(); GameObject.Destroy(ps); } }
public void ToPlayerWalkState() { player.GetComponent <CapsuleCollider> ().material.bounciness = 0f; Debug.Log("player is now in walk state"); player.currentState = player.walkState; }