TheKingsRace/Assets/Scripts/KingScripts/Goo.cs
Katherine ca07457b31 Slime Directionality
>The slime can be placed and sent in four different directions
>It's rough, and needs arrows added and tweaked
>Resided the Goo to be a square not a rectangle
>Gave the Slime and Hail Despawn timers
2022-02-13 14:18:27 -06:00

29 lines
680 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Goo : MonoBehaviour
{
int Lifetime = 0;
void FixedUpdate() {
Lifetime++;
if(Lifetime == 850) {
Destruction();
}
}
//Makes the player sliperly whenever they step on the goo
void OnTriggerEnter(Collider other) {
if (other.tag == "Player") {
Debug.Log("Slippy!");
GameObject player = other.gameObject;//Turns the collider into a game object
player.GetComponent<PlayerStats>().Traction = 1.5f;//Make it slippy
}
}
void Destruction() {
Destroy(gameObject);
}
}