using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AtomExplode : MonoBehaviour
{
	[SerializeField]
	private Transform[] protons;
	private Vector3[] directions;
	[SerializeField]
	private float speed = 10;

	public void Explode()
	{
		enabled = true;

		directions = new Vector3[protons.Length];

		for(int i = 0; i < protons.Length; i++)
		{
			directions[i] = protons[i].position.normalized;
		}
	}

	void Update()
	{
		for(int i = 0; i < protons.Length; i++)
		{
			protons[i].Translate(directions[i] * Time.deltaTime * speed);
		}
	}
}
