public Instance() { Hash = Guid.NewGuid(); PhysicsVariables = new PhysicsVariables(); Position = new Coord(0, 0); Depth = 0; }
private void startShooting() { shooting = true; newRock = (GameObject)Instantiate(rock, new Vector3(100f, 100, 0), Quaternion.Euler(0, 0, 0f)); rockVar = newRock.GetComponent <PhysicsVariables>(); newRock.GetComponent <CircleCollider2D>().enabled = false; rockVar.r = 0.1f; rockVar.m = 20f; }
public Instance() { Hash = Guid.NewGuid(); PhysicsVariables = new PhysicsVariables(); Position = new Coord(0, 0); Depth = 0; _imageIndex = 0; _currentImageSpeed = 0; }
public void collide(RaycastHit2D hit) { PhysicsVariables theirPhys = hit.collider.GetComponent <PhysicsVariables>(); float tmp = 1f / (phys.m + theirPhys.m); Vector3 newV1 = (((phys.m - (e * theirPhys.m)) * phys.state[1] * tmp) + ((1 + e) * theirPhys.m * theirPhys.state[1] * tmp)); Vector3 newV2 = (((theirPhys.m - (e * phys.m)) * theirPhys.state[1] * tmp) + ((1 + e) * phys.m * phys.state[1] * tmp)); phys.state[1] = newV1; theirPhys.state[1] = newV2; if (gameObject.name == "Earth" || theirPhys.gameObject.name == "Earth") { Control.points -= 10; } }
// Use this for initialization void Start() { shooting = GetComponent <RockShooting>(); physics = GetComponent <ShipPhysics>(); phys = GetComponent <PhysicsVariables>(); }
// Use this for initialization void Start() { phys = GetComponent <PhysicsVariables>(); collision = GetComponent <ShipCollision>(); }
// Use this for initialization void Start() { mycollider = GetComponent <CircleCollider2D>(); phys = GetComponent <PhysicsVariables>(); Control = GameObject.Find("ControlObject").GetComponent <GlobalGameControl>(); }
// Use this for initialization void Start() { physVar = GetComponent <PhysicsVariables>(); }