arkanoid/Assets/Scripts/Powerup.cs
2021-03-18 13:57:21 +01:00

29 lines
694 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Powerup : MonoBehaviour
{
[Range(0,1)]
public float movementSpeed = 0.5f;
public void FixedUpdate()
{
var x = this.transform.position.x;
var y = this.transform.position.y;
var z = this.transform.position.z;
this.transform.position = new Vector3(x,y,z + movementSpeed);
}
public void Activate()
{
var randomNum = Random.Range(0,1f);
if (randomNum >= 0.5){
Gamemaster.instance.Slomo();
}else{
Gamemaster.instance.PaddleSizePowerup();
}
Object.Destroy(this.gameObject);
}
}