It gives me CS1513 thinks there needs to be a closing curly, but I checked it’s fine. What’s wrong?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScatterBallExplose : MonoBehaviour
{
public ParticleSystem ms;
private ParticleSystem ps;
private CameraShake cs;
public int life;
public static int maxLife = 3;
// Start is called before the first frame update
void Start()
{
cs = Camera.main.GetComponent<CameraShake>();
life = maxLife;
}
// Update is called once per frame
void Update()
{
}
void OnCollisionEnter2D(Collision2D col)
{
print("Collision detected");
float dx = col.transform.position.x - this.transform.position.x;
float dy = col.transform.position.y - this.transform.position.y;
//double hyp = Mathf.Sqrt(Mathf.Pow(dx, 2) + Mathf.Pow(dy, 2));
float atan = Mathf.Atan(dx / dy) * Mathf.Rad2Deg;
print(atan);
ps = Instantiate(ms);
ps.transform.rotation = Quaternion.Euler(90+atan,0,0);
ps.transform.position = this.transform.position;
ps.Play();
StartCoroutine(cs.Shake(.15f, transform.localScale.x, transform.localScale.y));
life--;
//UpdateScatterBallLifeColor(life);
}
void UpdateScatterBallLifeColor(int life)
{
private Color newColor = new Color(this.Color.red, this.Color.green, this.Color.blue, life/maxLife);
this.renderer.material.color = newColor;
}
}