void Start() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); controller = GetComponent <Controller2D>(); sr = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); impulseSource = GetComponent <CinemachineImpulseSource>(); gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2); maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); print("Gravity: " + gravity + " Jump Velocity: " + maxJumpVelocity); }
public bool canPlay = true; // Setup board and instantiate items // Setup board and instantiate items void BoardSetup() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); //Instantiate Board and set boardHolder to its transform. boardHolder = new GameObject("Board").transform; _items = new Item[width, height]; //Loop along x axis. for (int x = 0; x < width; x++) { //Loop along y axis for (int y = 0; y < height; y++) { _items[x, y] = InstantiateDoddle(x, y); } } }
private void Awake() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); }
protected override void OnAwake() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); }
private void Awake() { audioPlayer = AudioSourcePlayer.AddAsComponent(gameObject, audioManager); dialogTrigger = gameObject.GetComponent <DialogueTrigger>(); }