42 lines
		
	
	
		
			994 B
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			994 B
		
	
	
	
		
			C#
		
	
	
	
	
	
using System.Collections;
 | 
						|
using System.Collections.Generic;
 | 
						|
using UnityEngine;
 | 
						|
 | 
						|
public class Projectile : MonoBehaviour
 | 
						|
{
 | 
						|
    private bool collided;
 | 
						|
    Vector3 oldEulerAngles;
 | 
						|
 | 
						|
    private void Start()
 | 
						|
    {
 | 
						|
        // Will always be destroyed after 10 seconds.
 | 
						|
        Destroy(gameObject, 10);
 | 
						|
 | 
						|
        oldEulerAngles = transform.rotation.eulerAngles;
 | 
						|
    }
 | 
						|
    private void Update()
 | 
						|
    {
 | 
						|
        if (oldEulerAngles != transform.rotation.eulerAngles)
 | 
						|
        {
 | 
						|
            Destroy(gameObject);
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    private void onCollisionEnter(Collider other)
 | 
						|
    {
 | 
						|
        if (other.gameObject.tag != "IceBolt" && other.gameObject.tag != "Player" && !collided)
 | 
						|
        {
 | 
						|
            collided = true;
 | 
						|
            Destroy(gameObject);
 | 
						|
        }
 | 
						|
    }
 | 
						|
    private void onTriggerEnter(Collider other)
 | 
						|
    {
 | 
						|
        if (other.gameObject.tag != "IceBolt" && other.gameObject.tag != "Player" && !collided)
 | 
						|
        {
 | 
						|
            collided = true;
 | 
						|
            Destroy(gameObject);
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |