Ejemplo n.º 1
0
    public void PrepareShipForLevelLoad()
    {
        Dictionary <GameObject, IList <GameObject> > graph = shipGraph.Graph;

        foreach (GameObject key in graph.Keys)
        {
            foreach (GameObject value in graph[key])
            {
                JointScript.Attach(key, value);
            }

            key.collider.isTrigger = false;
            Destroy(key.GetComponent <ShipEditorScript>());

            key.AddComponent <DamageOnCollisionScript>();
            key.AddComponent <Enforce2DBehaviourScript>();


            DontDestroyOnLoad(key);
            if (key.tag == "Engine")
            {
                key.AddComponent <ThrusterScript>();
                ThrusterScript thrusterScript = key.GetComponent <ThrusterScript>();
                KeyScript      keyScript      = key.GetComponent <KeyScript>();

                thrusterScript.setKeyCode(keyScript.key);
                Destroy(keyScript);
                Destroy(key.transform.Find("EngineKeyText").gameObject);
            }
        }
    }
Ejemplo n.º 2
0
 void OnCollisionEnter(Collision coll)
 {
     Debug.Log("Colliding!");
     JointScript.Attach(this.gameObject, coll.gameObject);
     JointScript.Detach(this.gameObject, coll.gameObject);
 }