public MyPhysics Physics; //Physics Component //Used to Initialise Bullet public void Init(BulletInit Initiate) { //Get Components Physics = GetComponent <MyPhysics>(); //Gets Physics component from object (Makes sure physics is up to date) Transformation = GetComponent <myTransformation>(); //Gets Transformation Component from object (Makes sure transformation is up to date) //Reset Timeout timeoutDestructor = 0; //Set Scale Transformation.Scale = new MyVector3(2, 2, 2); //Set Physical Mass Physics.Mass = Initiate.mass; //Set Rotation And Translation Transformation.Translation = Initiate.GunPosition; //Apply a force in the direction of the gun and times it by the firing speed Physics.Force += VectorMaths.EulerAnglesToDirection(new MyVector3(Initiate.GunRotation.x, -Initiate.GunRotation.y, 0)) * Initiate.FireSpeed; Physics.Bouncy = true; //Force Bullet to be alive Alive = true; }
private void TryChild() { foreach (TreeNode t in this.target.GetLogicalChildren()) { if (t is BulletInit) { Init = t as BulletInit; } } }