Exemple #1
0
    private void OnTriggerStay(Collider col)
    {
        if (col.gameObject == containerObj)
        {
            // Reset rotational values
            containerObj.transform.eulerAngles = new Vector3(0.0f, 0.0f, 0.0f);

            // Spawn point depends on what kind of adjustment is specified
            // (absolute or relative)
            if (relativeAdjustment)
            {
                if (relativeX)
                {
                    containerObj.transform.position = new Vector3(
                        containerObj.transform.position.x + relativeAdj,
                        containerObj.transform.position.y,
                        containerObj.transform.position.z
                        );
                }

                if (relativeY)
                {
                    containerObj.transform.position = new Vector3(
                        containerObj.transform.position.x,
                        containerObj.transform.position.y + relativeAdj,
                        containerObj.transform.position.z
                        );
                }

                if (relativeZ)
                {
                    containerObj.transform.position = new Vector3(
                        containerObj.transform.position.x,
                        containerObj.transform.position.y,
                        containerObj.transform.position.z + relativeAdj
                        );
                }
            }

            else
            {
                // Tell the participant what just happened
                instrManComp.setTemporaryMessage("The bucket has been reset\nto its initial position.", 3.0f);

                containerObj.transform.position = new Vector3(
                    spawnX,
                    spawnY,
                    spawnZ
                    );
            }
        }
    }