// Use this for initialization public override void Start() { transform = GetComponent <TempTransform>(); radius = behaviour.transform.localScale.x; force = Constants.worldGravity * radius; maxDistance = force / .1f; ships = new GravityList(this); }
// Use this for initialization void Start() { //Sets up the line renderer line.SetVertexCount(2); line.SetWidth(0.5f, 0.5f); line.enabled = false; //makes sure the line is off gravityList = new GravityList(); line.renderer.sortingLayerName = "Effects"; //these need to be the same on upon initialization position = transform.position; }
//THIS MUST BE CALLED IMMEDIATELY AFTER NODE CREATION OR THE WORLD WILL END public void Initialize(int nodeNumber, int maxNodes, float timeStep, float cascadeDelay, GameObject projectee) { this.timeStep = timeStep; //time parameter in physics calcs this.cascadeDelay = cascadeDelay; //time before next node activation this.projectee = projectee; //whatever wants its motion predicted gravityList = new GravityList(); //linkedlist for gravity sources if (nodeNumber < maxNodes) //If we haven't reached the specified number of nodes then: { nextNode = (GameObject)GameObject.Instantiate(node, transform.position, Quaternion.identity); //Create a new node nodeScript = nextNode.GetComponent <ProjectionNode>(); //Fetch the new node's script for easy access nodeScript.Initialize(nodeNumber + 1, maxNodes, timeStep, cascadeDelay, projectee); //Initialize the next node with the same parameters, but iterate nodeNumber } }