示例#1
0
    void BreakBondWith(Atomic otherAtom)
    {
        // decrement or remove record of bondage to each other
        this.RemoveFromBondedAtoms(otherAtom);
        otherAtom.RemoveFromBondedAtoms(this);

        // trigger particle system
        GameObject prefab       = (GameObject)Resources.Load("BreakBondEnergy");
        Vector3    bondPosition = Vector3.Lerp(this.transform.position, otherAtom.transform.position, 0.5f);
        GameObject effect       = Instantiate(prefab, bondPosition, Quaternion.identity) as GameObject;

        Destroy(effect, 2);

        // NOTE Don't need to remove spring, because unity takes care of it.
    }