Beispiel #1
0
    public override void OnStateChanged(bool state, GameObject triggeringObject)
    {
        if (triggeringObject != null && state)
        {
            bool         isMain = FindObjectOfType <LevelManager>().IsMainPlayerObject(triggeringObject);
            SmoothCamera camera = FindObjectOfType <SmoothCamera>();
            Vector3      offset = camera.CameraPosition - triggeringObject.transform.position;
            offset.z = camera.CameraPosition.z;

            triggeringObject.transform.position = this.transform.position;

            if (isMain)
            {
                camera.SnapCamera(triggeringObject.transform.position + offset);
            }
        }
    }