// We are usng trigger so this gets called on overlap
    protected virtual void OnTriggerEnter2D(Collider2D collision)
    {
        Fake_Physics M_OtherObjects = collision.gameObject.GetComponent <Fake_Physics>();        // Finding FakePhysics Component Attached to objects

        Debug.Assert(M_OtherObjects != null, "Other Objects is not FakePhysics Compatible");     // If its not related to FakePhysics Message Appears

        ObjectHit(M_OtherObjects);
    }
    protected override void ObjectHit(Fake_Physics Other_Objects)
    {
        base.ObjectHit(Other_Objects);

        PC_Collider.enabled = false;

        if (PC_Collider.enabled == false)
        {
            Destroy(gameObject);      // Destroys Player Prefab
            GM.s_GM.PC_dead = true;   // Sets boolean flag to true and starts the GM Respawn
        }
    }
Beispiel #3
0
    protected override void ObjectHit(Fake_Physics Other_Objects)
    {
        base.ObjectHit(Other_Objects);                  // Referencing the base Function from Fake Physics
        PC_Collider.enabled = false;                    // Turns off collision

        // Destroys the Big Rock and Plays sound effect and particle element
        if (PC_Collider.enabled == false)                                                                         // If Collision is off
        {
            Destroy(gameObject);                                                                                  // Destroy this object
            GameObject Particle_Element = Instantiate(Explosion_Prefab, transform.position, Quaternion.identity); // Spawn Particle elements on Asteroid Death
            Destroy(Particle_Element, 3f);                                                                        // Destroys Explosion Prefab after 3

            // Tell the GM to score some points
            GM.s_GM.SendMessage("ScorePoints", points);

            Flickering_TextMesh();

            foreach (GameObject GOrock in RockPrefabs)
            {
                Instantiate(GOrock, transform.position, Quaternion.identity);
            }
        }
    }
    protected override void ObjectHit(Fake_Physics Other_Objects)
    {
        base.ObjectHit(Other_Objects);

        Destroy(gameObject);        // Destroys GameObject When colliding with other objects with the fake physics collision reference attached
    }
 protected virtual void ObjectHit(Fake_Physics Other_Objects)
 {
     //Debug.LogFormat("{0} Hit by {1}", name, Other_Objects);         // Print message for now
 }