This commit is contained in:
Gerard Gascón 2025-04-24 17:19:36 +02:00
commit 001bb14f16
951 changed files with 270074 additions and 0 deletions

View file

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Humo : MonoBehaviour, IPooledObject{
int transparencia;
float currentTrans;
float scale;
public float speed;
public float fadeSpeed;
public float scaleSpeed;
HumoLookAt lookat;
RawImage image;
// Start is called before the first frame update
public void OnObjectSpawn(){
lookat = GetComponentInParent<HumoLookAt>();
image = GetComponent<RawImage>();
transparencia = Random.Range(25, 75);
currentTrans = transparencia;
scale = Random.Range(1f, 2.5f);
transform.localScale = new Vector3(scale, scale, scale);
image.color = new Color(image.color.r, image.color.g, image.color.b, currentTrans / 255);
transform.rotation = lookat.t;
}
// Update is called once per frame
void Update(){
transform.Translate(Vector2.up * speed * Time.deltaTime);
currentTrans = currentTrans - fadeSpeed;
image.color = new Color(image.color.r, image.color.g, image.color.b, currentTrans / 255);
image.transform.localScale = new Vector3(scale - scaleSpeed * Time.deltaTime, scale - scaleSpeed * Time.deltaTime, scale - scaleSpeed * Time.deltaTime);
}
}