Exemple #1
0
 public Instance()
 {
     Hash             = Guid.NewGuid();
     PhysicsVariables = new PhysicsVariables();
     Position         = new Coord(0, 0);
     Depth            = 0;
 }
Exemple #2
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;
 }
Exemple #3
0
 public Instance()
 {
     Hash               = Guid.NewGuid();
     PhysicsVariables   = new PhysicsVariables();
     Position           = new Coord(0, 0);
     Depth              = 0;
     _imageIndex        = 0;
     _currentImageSpeed = 0;
 }
Exemple #4
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;
        }
    }
Exemple #5
0
 // Use this for initialization
 void Start()
 {
     shooting = GetComponent <RockShooting>();
     physics  = GetComponent <ShipPhysics>();
     phys     = GetComponent <PhysicsVariables>();
 }
Exemple #6
0
 // Use this for initialization
 void Start()
 {
     phys      = GetComponent <PhysicsVariables>();
     collision = GetComponent <ShipCollision>();
 }
Exemple #7
0
 // Use this for initialization
 void Start()
 {
     mycollider = GetComponent <CircleCollider2D>();
     phys       = GetComponent <PhysicsVariables>();
     Control    = GameObject.Find("ControlObject").GetComponent <GlobalGameControl>();
 }
Exemple #8
0
 // Use this for initialization
 void Start()
 {
     physVar = GetComponent <PhysicsVariables>();
 }