Hi everyone. I followed the unity space shooter tutorial but have changed into a side scroller and I am trying to add features. I am stuck on camera shake. If anyone could direct me or help me implement it when the bullet hits the object I would be grateful. I am also trying to add point display at the origin of the explosion when the object is hit but that is a secondary issue. Thanks
using UnityEngine;
using System.Collections;
public class DestroyByContactAlt : MonoBehaviour
{
public GameObject explosion;
public GameObject explosionAlt;
public GameObject playerExplosion;
public int scoreValue;
//public TextGenerator killText;
private GameController gameController;
void Start()
{
GameObject gameControllerObject = GameObject.FindWithTag("GameController");
if (gameControllerObject != null)
{
gameController = gameControllerObject.GetComponent<GameController>();
}
if (gameController == null)
{
Debug.Log("Cannot find 'GameController' script");
}
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "Boundary")
{
return;
}
Instantiate(explosion, transform.position, transform.rotation);
Instantiate(explosionAlt, transform.position, transform.rotation);
//Instantiate (killText, transform.position, transform.rotation);
if (other.tag == "Player")
{
Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
gameController.GameOver();
}
gameController.AddScore(scoreValue);
Destroy(other.gameObject);
Destroy(gameObject);
}
}