Example #1
0
    private void AbsorbObject(GameObject objectToAbsorb)
    {
        LevelObject absorbedObject = objectToAbsorb.GetComponent <LevelObject>();

        //Disable collision on the object so we can pull it through the front wall
        absorbedObject.SetCollision(false);

        //Pull the object towards us, shrink it and put it in the display container
        StartCoroutine(PullObject(objectToAbsorb, muzzlePosition.position, new Vector3(0.02f, 0.02f, 0.02f), 3f));

        //Tell the object to animate
        absorbedObject.enableRotation = true;

        //Destroy an existing object if we have one
        DestroyExistingWeaponObject();

        //Set the absorbed object as our one for firing.
        SetWeaponObjectProperties(objectToAbsorb);
    }