예제 #1
0
        public override object ReadJson(JsonReader reader,
                                        Type t,
                                        object existingValue,
                                        JsonSerializer serializer)
        {
            switch (reader.TokenType)
            {
            case JsonToken.Boolean:
                bool boolValue = serializer.Deserialize <bool>(reader);

                return(new SphereUnion
                {
                    Bool = boolValue
                });

            case JsonToken.StartObject:
                SphereClass objectValue = serializer.Deserialize <SphereClass>(reader);

                return(new SphereUnion
                {
                    SphereClass = objectValue
                });
            }

            throw new Exception("Cannot unmarshal type SphereUnion");
        }
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            ICamera   scenecamera = (ICamera)m_sceneHookHelper.Camera;
            IVector3D pvector3D   = new Vector3DClass();

            pvector3D.ConstructDifference(scenecamera.Observer, scenecamera.Target);
            ISphere pShere = new SphereClass();

            pShere.Center = scenecamera.Target;
            pShere.Radius = scenecamera.ViewingDistance * Math.Tan(scenecamera.ViewFieldAngle * Math.PI / 180) * 0.5;
            IEnvelope penve = pShere.Envelope;

            m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.VisibleBounds = penve;
            m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
        }
예제 #3
0
    private void OnTriggerEnter(Collider collider)
    {
        SphereClass sphere = collider.GetComponent <SphereClass>();

        // when it is not a sphere
        if (sphere == null)
        {
            return;
        }

        if (!sphere.isCounted)
        {
            Material sphereMaterial = collider.GetComponent <MeshRenderer>().material;
            CheckSurface(gameObject, sphereMaterial);
            // mark the sphere that it got counted
            sphere.isCounted = true;
            spheresCount++;
            // update score
            counterText.text = "Spheres: " + spheresCount + "\nScore : " + count;
        }
    }