Esempio n. 1
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Id != null?Id.GetHashCode() : 0;

                hashCode = hashCode * 397 ^ (Title != null ? Title.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ (Body != null ? Body.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ (Image != null ? Image.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ (TileImage != null ? TileImage.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ Hidden.GetHashCode();
                hashCode = hashCode * 397 ^ Spotlight.GetHashCode();
                hashCode = hashCode * 397 ^ (Type != null ? Type.GetHashCode() : 0);
                hashCode = hashCode * 397 ^ (EntryType != null ? EntryType.GetHashCode() : 0);
                return(hashCode);
            }
        }
Esempio n. 2
0
        private void InitSceneLights(Node groupNode)
        {
            var rootLightNode = new Node();

            // Construct a spot light for shadows
            var spotLight = new Spotlight
            {
                Position      = new Vector(0, 5, 0),
                Color         = Color.ParseColor("#FFFFFF"),
                Direction     = new Vector(0, -1, 0),
                Intensity     = 300,
                InnerAngle    = 5,
                OuterAngle    = 25,
                ShadowMapSize = 2048,
                ShadowNearZ   = 2,
                ShadowFarZ    = 7,
                ShadowOpacity = .7f,
                CastsShadow   = true
            };

            rootLightNode.AddLight(spotLight);

            // Add our shadow planes.
            var material = new Material();

            material.SetShadowMode(Material.ShadowMode.Transparent);
            var surface = new Surface(2, 2)
            {
                Materials = new List <Material>()
                {
                    material
                }
            };
            var surfaceShadowNode = new Node();

            surfaceShadowNode.SetRotation(new Vector(Math.ToRadians(-90), 0, 0));
            surfaceShadowNode.Geometry = surface;
            surfaceShadowNode.SetPosition(new Vector(0, 0, -0.7));
            rootLightNode.AddChildNode(surfaceShadowNode);
            groupNode.AddChildNode(rootLightNode);

            var environment = Texture.LoadRadianceHDRTexture(Uri.Parse("file:///android_asset/garage_1k.hdr"));

            mScene.LightingEnvironment = environment;
        }
        protected override void ExecuteAction(string ribbonId)
        {
            if (this.GetAddIn().Application.ActiveWindow.Selection.Type !=
                Microsoft.Office.Interop.PowerPoint.PpSelectionType.ppSelectionShapes)
            {
                return;
            }

            this.StartNewUndoEntry();
            PowerPointPresentation pres  = this.GetCurrentPresentation();
            PowerPointSlide        slide = this.GetCurrentSlide();

            ClipboardUtil.RestoreClipboardAfterAction(() =>
            {
                Spotlight.AddSpotlightEffect();
                return(ClipboardUtil.ClipboardRestoreSuccess);
            }, pres, slide);
        }
Esempio n. 4
0
 private void ContentFrameOnNavigated(object sender, NavigationEventArgs args)
 {
     if (ContentFrame.BackStackDepth > 0)
     {
         HamburgerButton.ShowBack();
         if (ContentFrame.Content is SongsCollectionPage)
         {
             AppTitleTextBlock.Foreground = HamburgerButton.Foreground = new SolidColorBrush(Colors.White);
         }
     }
     else
     {
         AppTitleTextBlock.Text = App.ResourceLoader.GetString("Text_Title_App");
         HamburgerButton.ShowMenu();
         AppTitleTextBlock.Foreground = HamburgerButton.Foreground = App.Current.Resources["TitleBarForegroundBrush"] as SolidColorBrush;
         Spotlight.Show(true);
         App.ResetTitleBarToAccentColor();
     }
 }
Esempio n. 5
0
        public List <Spotlight> SpotlightList()
        {
            CreateView("/home", DateTime.Now, "Home");

            MySqlCommand    cmd = new MySqlCommand("proc_spotlight_list", conn);
            MySqlDataReader reader;

            cmd.CommandType = CommandType.StoredProcedure;

            List <Spotlight> Spotlights = new List <Spotlight>();
            Spotlight        Spotlight  = new Spotlight();

            try
            {
                conn.Open();
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Spotlight.Id     = int.Parse(reader.GetString(0));
                    Spotlight.Width  = reader.GetValue(1).ToString();
                    Spotlight.Height = reader.GetValue(2).ToString();
                    Spotlight.Img    = reader.GetValue(3).ToString();
                    Spotlight.Link   = reader.GetValue(4).ToString();
                    Spotlight.Title  = reader.GetValue(5).ToString();
                    Spotlight.Type   = reader.GetValue(6).ToString();

                    Spotlights.Add(Spotlight);
                    Spotlight = new Spotlight();
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                conn.Close();
            }

            return(Spotlights);
        }
 public async Task <ActionResult <IEnumerable <Spotlight> > > Put(Spotlight spotlight)
 {
     try
     {
         if (_checker.IsObjectComplete(spotlight))
         {
             await _adminService.Update(spotlight);
         }
         else
         {
             _logger.LogError("invalid spotlight tried to be updated");
             return(Problem("invalid spotlight tried to be updated"));
         }
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, "exeption while updated spotlight");
         return(Problem("exeption while updated spotlight"));
     }
     return(InnerGet());
 }
        public async Task <ActionResult <IEnumerable <Spotlight> > > Post([FromBody] Spotlight spotlight)
        {
            try
            {
                if (_checker.IsObjectComplete(spotlight, true))
                {
                    await _adminService.Add(spotlight);
                }
                else
                {
                    _logger.LogError("invalid spotlight tried to be added");
                    return(Problem("invalid spotlight tried to be added"));
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "exeption while adding spotlight");
                return(Problem("exeption while adding spotlight"));
            }

            return(InnerGet());
        }
Esempio n. 8
0
        public Spotlight SpotlightSelect(int id_Spotlight)
        {
            MySqlCommand    cmd = new MySqlCommand("proc_spotlight_select", conn);
            MySqlDataReader reader;

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new MySqlParameter("p_id_spotlight", id_Spotlight));

            Spotlight Spotlight = new Spotlight();

            try
            {
                conn.Open();
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    Spotlight.Id     = int.Parse(reader.GetString(0));
                    Spotlight.Width  = reader.GetValue(1).ToString();
                    Spotlight.Height = reader.GetValue(2).ToString();
                    Spotlight.Img    = reader.GetValue(3).ToString();
                    Spotlight.Title  = reader.GetValue(4).ToString();
                    Spotlight.Link   = reader.GetValue(5).ToString();
                    Spotlight.Type   = reader.GetValue(6).ToString();
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                conn.Close();
            }

            return(Spotlight);
        }
Esempio n. 9
0
 void Start()
 {
     newCollider = GetComponentInParent <CapsuleCollider>();
     spotlight   = GetComponentInParent <Spotlight>();
 }
Esempio n. 10
0
        public void loaddata()
        {
            // school data

            spotlight = Spotlight.Select(Guid.Parse(Membership.GetUser().ProviderUserKey.ToString()));

            if (spotlight != null)
            {
                Awards.Text       = string.IsNullOrEmpty(spotlight.Awards) ? string.Empty : spotlight.Awards;
                Achievements.Text = string.IsNullOrEmpty(spotlight.Achievements) ? string.Empty : spotlight.Achievements;
                CurentGPA.Text    = string.IsNullOrEmpty(spotlight.CurentGPA) ? string.Empty : spotlight.CurentGPA;
                Involvments.Text  = string.IsNullOrEmpty(spotlight.Involvments) ? string.Empty : spotlight.Involvments;

                if (spotlight.OraganizationId.HasValue)
                {
                    for (int i = 0; i < DrpOraganizations.Items.Count; i++)
                    {
                        if (DrpOraganizations.Items[i].Value.ToString().ToLower() == spotlight.OraganizationId.ToString().ToLower())
                        {
                            DrpOraganizations.ClearSelection();
                            DrpOraganizations.Items[i].Selected = true;
                        }
                    }
                }

                if (spotlight.FraternityId.HasValue)
                {
                    for (int i = 0; i < DrpFraternity.Items.Count; i++)
                    {
                        if (DrpFraternity.Items[i].Value.ToString().ToLower() == spotlight.OraganizationId.ToString().ToLower())
                        {
                            DrpFraternity.ClearSelection();
                            DrpFraternity.Items[i].Selected = true;
                        }
                    }
                }

                if (spotlight.SoroityId.HasValue)
                {
                    for (int i = 0; i < DrpSoroity.Items.Count; i++)
                    {
                        if (DrpSoroity.Items[i].Value.ToString().ToLower() == spotlight.SoroityId.ToString().ToLower())
                        {
                            DrpSoroity.ClearSelection();
                            DrpSoroity.Items[i].Selected = true;
                        }
                    }
                }

                if (spotlight.GreakOrganizationId.HasValue)
                {
                    for (int i = 0; i < DrpGreekOrganizations.Items.Count; i++)
                    {
                        if (DrpGreekOrganizations.Items[i].Value.ToString().ToLower() == spotlight.GreakOrganizationId.ToString().ToLower())
                        {
                            DrpGreekOrganizations.ClearSelection();
                            DrpGreekOrganizations.Items[i].Selected = true;
                        }
                    }
                }

                if (spotlight.GreekHonorSocitiesId.HasValue)
                {
                    for (int i = 0; i < DrpGreekHonorSocities.Items.Count; i++)
                    {
                        if (DrpGreekHonorSocities.Items[i].Value.ToString().ToLower() == spotlight.GreekHonorSocitiesId.ToString().ToLower())
                        {
                            DrpGreekHonorSocities.ClearSelection();
                            DrpGreekHonorSocities.Items[i].Selected = true;
                        }
                    }
                }
            }
        }
Esempio n. 11
0
 private void CreatePlaylistButton_OnClick(object sender, RoutedEventArgs e)
 {
     ContentFrame.Navigate(typeof(CreatePlaylistPage));
     SplitView.IsPaneOpen = false;
     Spotlight.Hide(true);
 }
Esempio n. 12
0
        private void Init3DModelProduct()
        {
            // Create our group node containing the light, shadow plane, and 3D models
            mProductModelGroup = new Node();

            // Create a light to be shined on the model.
            Spotlight spotLight = new Spotlight();

            spotLight.InfluenceBitMask         = 1;
            spotLight.Position                 = new Vector(0, 5, 0);
            spotLight.CastsShadow              = true;
            spotLight.AttenuationEndDistance   = 7;
            spotLight.AttenuationStartDistance = 4;
            spotLight.Direction                = new Vector(0, -1, 0);
            spotLight.Intensity                = 6000;
            spotLight.ShadowOpacity            = 0.35f;
            mProductModelGroup.AddLight(spotLight);

            // Create a mock shadow plane in AR
            Node     shadowNode    = new Node();
            var      shadowSurface = new Surface(20, 20);
            Material material      = new Material();

            material.SetShadowMode(Material.ShadowMode.Transparent);
            material.SetLightingModel(Material.LightingModel.Lambert);
            shadowSurface.Materials = new List <Material>()
            {
                material
            };
            shadowNode.Geometry = shadowSurface;
            shadowNode.LightReceivingBitMask = 1;
            shadowNode.SetPosition(new Vector(0, -0.01, 0));
            shadowNode.SetRotation(new Vector(-1.5708, 0, 0));
            // We want the shadow node to ignore all events because it contains a surface of size 20x20
            // meters and causes this to capture events which will bubble up to the mProductModelGroup node.
            shadowNode.IgnoreEventHandling = true;
            mProductModelGroup.AddChildNode(shadowNode);

            // Load the model from the given mSelected Product
            Object3D productModel = new Object3D();

            productModel.LoadModel(mViroView.ViroContext, Uri.Parse(mSelectedProduct != null?mSelectedProduct.ThreeDModelUri:""), Object3D.Type.Fbx,
                                   new AsyncObject3DListener2(this));

            // Make this 3D Product object draggable.
            mProductModelGroup.SetDragType(Node.DragType.FixedToWorld);
            mProductModelGroup.Drag += (s, e) => { };
            // Set gesture listeners such that the user can rotate this model.
            productModel.GestureRotate += (s, e) =>
            {
                if (e.P3 == RotateState.RotateEnd)
                {
                    mLastProductRotation = mSavedRotateToRotation;
                }
                else
                {
                    Vector rotateTo = new Vector(mLastProductRotation.X, mLastProductRotation.Y + e.P2,
                                                 mLastProductRotation.Z);
                    mProductModelGroup.SetRotation(rotateTo);
                    mSavedRotateToRotation = rotateTo;
                }
            };

            mProductModelGroup.Opacity = 0;
            mProductModelGroup.AddChildNode(productModel);
        }
 // GET: / Spotlight / Full Archives
 public ActionResult Archives()
 {
     ViewBag.DataArchives = Spotlight.GetSpotlights();
     ViewBag.currSpot     = Spotlight.CurrSpotlight(currSpotlight);
     return(View());
 }
Esempio n. 14
0
 public void RockstarTestsTearDown()
 {
     testObj_spotlight = null;
     testObj           = null;
 }
Esempio n. 15
0
 // Start is called before the first frame update
 void Start()
 {
     spotlightcontrol = GetComponentInParent <Spotlight>();
 }
Esempio n. 16
0
 public void SpotlightTestsSetUp()
 {
     testObj           = new GameObject();
     testObj_spotlight = testObj.AddComponent <Spotlight>() as Spotlight;
     testObj_spotlight.Init(60f);
 }
Esempio n. 17
0
 // Use this for initialization
 void Start()
 {
     ray             = transform.FindChild("Spotlight Ray");
     rayScript       = ray.GetComponent <Spotlight>();
     rayScript.going = false;
 }
        public virtual IEnumerator<ITask> SpotlightHandler(Spotlight spotlight)
        {
            _state.SpotlightOn = spotlight.Body.SpotlightOn;
            LegoSetInputMode cmd = new LegoSetInputMode(_state.SensorPort, _state.SpotlightOn ? LegoSensorType.LightActive : LegoSensorType.LightInactive, LegoSensorMode.PercentFullScaleMode);
            _legoBrickPort.SendNxtCommand(cmd);

            yield return Arbiter.Choice(_legoBrickPort.SendNxtCommand(cmd),
                delegate(LegoResponse response)
                {
                    if (response.Success)
                    {
                        spotlight.ResponsePort.Post(DefaultUpdateResponseType.Instance);
                        // Spotlight notifications are only sent to subscribers to the native service
                        SendNotification<Spotlight>(_subMgrPort, spotlight);
                    }
                    else
                    {
                        spotlight.ResponsePort.Post(
                            Fault.FromException(
                                new InvalidOperationException(response.ErrorCode.ToString())));
                    }
                },
                delegate(Fault fault)
                {
                    spotlight.ResponsePort.Post(fault);
                });

            yield break;
        }
Esempio n. 19
0
        private Node initLightingNode()
        {
            Vector[] omniLightPositions = { new Vector(-3,  3, 0.3),
                                            new Vector(3,   3,   1),
                                            new Vector(-3, -3,   1),
                                            new Vector(3,  -3, 1) };

            Node lightingNode = new Node();

            foreach (Vector pos in omniLightPositions)
            {
                OmniLight light = new OmniLight
                {
                    Position  = pos,
                    Color     = Color.ParseColor("#FFFFFF"),
                    Intensity = 20,
                    AttenuationStartDistance = 6,
                    AttenuationEndDistance   = 9
                };

                lightingNode.AddLight(light);
            }

            // The spotlight will cast the shadows
            Spotlight spotLight = new Spotlight();

            spotLight.Position      = new Vector(0, 5, -0.5);
            spotLight.Color         = (Color.ParseColor("#FFFFFF"));
            spotLight.Direction     = (new Vector(0, -1, 0));
            spotLight.Intensity     = (50);
            spotLight.ShadowOpacity = (0.4f);
            spotLight.ShadowMapSize = (2048);
            spotLight.ShadowNearZ   = (2f);
            spotLight.ShadowFarZ    = (7f);
            spotLight.InnerAngle    = (5);
            spotLight.OuterAngle    = (20);
            spotLight.CastsShadow   = (true);

            lightingNode.AddLight(spotLight);

            // Add a lighting environment for realistic PBR rendering
            Texture environment = Texture.LoadRadianceHDRTexture(Uri.Parse("file:///android_asset/wakanda_360.hdr"));

            mScene.LightingEnvironment = (environment);

            // Add shadow planes: these are "invisible" surfaces on which virtual shadows will be cast,
            // simulating real-world shadows
            Material material = new Material();

            material.SetShadowMode(Material.ShadowMode.Transparent);

            Surface surface = new Surface(3, 3);

            surface.Materials = new List <Material>()
            {
                material
            };

            Node surfaceShadowNode = new Node();

            surfaceShadowNode.SetRotation(new Vector(Math.ToRadians(-90), 0, 0));
            surfaceShadowNode.Geometry = surface;
            surfaceShadowNode.SetPosition(new Vector(0, 0, 0.0));
            lightingNode.AddChildNode(surfaceShadowNode);

            lightingNode.SetRotation(new Vector(Math.ToRadians(-90), 0, 0));
            return(lightingNode);
        }
Esempio n. 20
0
    void SpawnSpotlight(Vector3 spotlightPosition, float duration)
    {
        Spotlight newSpotlight = Instantiate(spotlight, spotlightPosition, Quaternion.Euler(Vector3.right * 90)) as Spotlight;

        newSpotlight.Create(duration);
    }
 public bool SpotlightUpdate(Spotlight n)
 {
     return(_SpotlightDAL.SpotlightUpdate(n));
 }
        //
        // GET: / Spotlight / Partial Archives

        public ActionResult Index(int slideOrder)
        {
            ViewBag.Archives = Spotlight.GetSpotlights();
            ViewBag.CurrSpot = Spotlight.CurrSpotlight(slideOrder);
            return(View());
        }
Esempio n. 23
0
    void Update()
    {
        RaycastHit hit;
        Ray        ray = PlayerCam.ScreenPointToRay(Input.mousePosition);

        if (Input.GetMouseButtonDown(0))
        {
            if (inventory.selected == 0)
            {
                punchAnim.SetTrigger("PunchTorch");
                if (Physics.Raycast(ray, out hit, 4f))
                {
                    if (hit.transform.tag == "AI")
                    {
                        AIController AI = hit.transform.GetComponent <AIController>();
                        AI.Health         -= 20f;
                        AI.Agressive       = true;
                        AI.PathFinder      = false;
                        AI.DetectionRange += 5f;
                    }
                }
            }
            if (inventory.selected == 2)
            {
                punchAnim.SetTrigger("PunchPick");


                if (Physics.Raycast(ray, out hit, 4f))
                {
                    GameObject PickSpark = Instantiate(pickaxeSparks, hit.point, Quaternion.LookRotation(hit.normal));
                    Destroy(PickSpark, 3f);
                    if (hit.transform.tag == "Mineable")
                    {
                        Mineable mine = hit.transform.GetComponent <Mineable>();

                        mine.Health -= 50f;
                        mine.MineRefresh();
                        mine.Save();
                    }



                    if (hit.transform.tag == "AI")
                    {
                        AIController AI = hit.transform.GetComponent <AIController>();
                        AI.Health         -= 50f;
                        AI.Agressive       = true;
                        AI.PathFinder      = false;
                        AI.DetectionRange += 5f;
                    }
                }
            }
        }
        if (Physics.Raycast(ray, out hit, 2f))
        {
            if (hit.transform.tag == "SpotLight")
            {
                Spotlight spotlight = hit.transform.GetComponent <Spotlight>();
                SpotlightPanel.SetActive(true);
                SpotDistanceSlider.value    = spotlight.distance;
                SpotDistanceSlider.maxValue = spotlight.MaxDistance;
                if (spotlight.Toggled == true)
                {
                    SpotlightStatus.text  = "Enabled";
                    SpotlightStatus.color = Color.green;
                }
                else
                {
                    if (spotlight.distance > spotlight.MaxDistance)
                    {
                        SpotlightStatus.text  = "Out of range";
                        SpotlightStatus.color = Color.red;
                    }
                    else
                    {
                        if (spotlight.generator.GetComponent <Generator>().Toggled == true)
                        {
                            SpotlightStatus.text  = "Disabled";
                            SpotlightStatus.color = Color.yellow;
                        }
                        else
                        {
                            SpotlightStatus.text  = "Unpowered";
                            SpotlightStatus.color = Color.cyan;
                        }
                    }
                }

                if (Input.GetKeyDown("e"))
                {
                    spotlight.Toggle();
                    spotlight.Save();
                }
            }
        }


        if (Physics.Raycast(ray, out hit, 2f))
        {
            if (hit.transform.tag == "Generator")
            {
                GenFuelSlider.value = hit.transform.GetComponent <Generator>().CurrentFuel;
                if (hit.transform.GetComponent <Generator>().Toggled == true)
                {
                    GeneratorStatus.text  = "Running";
                    GeneratorStatus.color = Color.green;
                }
                else
                {
                    if (hit.transform.GetComponent <Generator>().CurrentFuel >= 3)
                    {
                        GeneratorStatus.text  = "Stopped";
                        GeneratorStatus.color = Color.yellow;
                    }
                    else
                    {
                        GeneratorStatus.text  = "Out of fuel";
                        GeneratorStatus.color = Color.red;
                    }
                }
                GeneratorPanel.SetActive(true);
                if (Input.GetKeyDown("e"))
                {
                    hit.transform.GetComponent <Generator>().Toggle();
                    hit.transform.GetComponent <Generator>().SaveStats();
                }
                if (inventory.selected == 1 && OilHolder.HoldingNow >= 1)
                {
                    RefillPanelGenerator.SetActive(true);
                    if (Input.GetKeyDown("r"))
                    {
                        OilHolder.HoldingNow--;
                        hit.transform.GetComponent <Generator>().CurrentFuel += 1000;
                        hit.transform.GetComponent <Generator>().SaveStats();
                        OilHolder.Save();
                    }
                }
                else
                {
                    RefillPanelGenerator.SetActive(false);
                }
            }
        }


        if (Physics.Raycast(ray, out hit, 2f))
        {
            if (hit.transform.tag == "Eatable" && hit.transform.GetComponent <Eatable>().FoodAmount > 1)
            {
                EatPanel.SetActive(true);
                EatSlider.maxValue = hit.transform.GetComponent <Eatable>().MaxFood;
                EatSlider.value    = hit.transform.GetComponent <Eatable>().FoodAmount;
                if (Input.GetKeyDown("e"))
                {
                    if (hit.transform.GetComponent <Eatable>().FoodAmount > 1)
                    {
                        if (stats.Hunger < 950 || stats.Thirst < 950)
                        {
                            stats.Hunger += hit.transform.GetComponent <Eatable>().SaturationAmount;
                            stats.Thirst += hit.transform.GetComponent <Eatable>().WaterAmount;
                            stats.Health += 100;
                            hit.transform.GetComponent <Eatable>().FoodAmount--;
                            hit.transform.GetComponent <Eatable>().Save();
                        }
                    }
                }
            }
        }


        if (Physics.Raycast(ray, out hit, 2f))
        {
            if (hit.transform.tag == "OilBarrel")
            {
                OilBarrelStats.maxValue = hit.transform.GetComponent <OilBarrel>().MaxFuel;
                OilBarrelStats.value    = hit.transform.GetComponent <OilBarrel>().fuel;
                TakeOilPanel.SetActive(true);
                if (Input.GetKeyDown("e"))
                {
                    if (hit.transform.GetComponent <OilBarrel>().fuel >= 2 && OilHolder.HoldingNow == 0)
                    {
                        OilHolder.HoldingNow += 2;
                        hit.transform.GetComponent <OilBarrel>().fuel -= 2;
                        OilHolder.Save();
                        hit.transform.GetComponent <OilBarrel>().Save();
                    }
                    else
                    {
                        if (hit.transform.GetComponent <OilBarrel>().fuel >= 1)
                        {
                            if (OilHolder.HoldingNow != 2)
                            {
                                OilHolder.HoldingNow += 1;
                                hit.transform.GetComponent <OilBarrel>().fuel -= 1;
                                OilHolder.Save();
                                hit.transform.GetComponent <OilBarrel>().Save();
                            }
                        }
                    }
                }
            }
        }

        if (Physics.Raycast(ray, out hit, 2f))
        {
            if (hit.transform.tag == "DrinkAble")
            {
                if (hit.transform.GetComponent <WaterDrinkable>().WaterAmount >= 1)
                {
                    DrinkPanel.SetActive(true);
                    if (Input.GetKeyDown("e"))
                    {
                        if (stats.Thirst <= 950)
                        {
                            stats.Thirst += 170;
                            hit.transform.GetComponent <WaterDrinkable>().WaterAmount -= 1;
                            hit.transform.GetComponent <WaterDrinkable>().Save();
                        }
                    }
                }
            }
        }


        if (Physics.Raycast(ray, out hit, 2f))
        {
            if (hit.transform.GetComponent <Rigidbody>() != null)
            {
                GrabIcon.SetActive(true);

                if (Input.GetMouseButton(1))
                {
                    joint.connectedBody = hit.transform.GetComponent <Rigidbody>();
                    grabbing            = true;
                }
                if (Input.GetMouseButtonUp(1))
                {
                    joint.connectedBody = null;
                    GrabIcon.SetActive(false);
                    grabbing = false;
                }
            }
        }



        if (Physics.Raycast(ray, out hit))
        {
            if (hit.transform.tag != "SpotLight")
            {
                SpotlightPanel.SetActive(false);
            }
            if (hit.transform.tag != "Generator")
            {
                GeneratorPanel.SetActive(false);
            }
            if (hit.transform.tag != "OilBarrel")
            {
                TakeOilPanel.SetActive(false);
            }
            if (hit.transform.tag != "DrinkAble")
            {
                DrinkPanel.SetActive(false);
            }
            if (hit.transform.tag != "Eatable")
            {
                EatPanel.SetActive(false);
            }

            if (Input.GetMouseButtonUp(1))
            {
                joint.connectedBody = null;
                GrabIcon.SetActive(false);
                grabbing = false;
            }

            if (hit.transform.tag != "LampControl")
            {
                LampInfo.SetActive(false);
            }

            if (hit.transform.GetComponent <Rigidbody>() == null)
            {
                if (grabbing == false)
                {
                    GrabIcon.SetActive(false);
                }
            }
        }


        if (Physics.Raycast(ray, out hit, 2f))
        {
            if (hit.transform.tag == "LampControl") //LAMP CONTROLLER
            {
                Debug.Log("Ray hit lamp " + hit.transform.name);
                Transform objHit = hit.transform;
                fuel.value = objHit.GetComponent <Lantern>().Fuel;
                LampInfo.SetActive(true);

                if (OilHolder.HoldingNow > 0 && inventory.selected == 1)
                {
                    if (objHit.GetComponent <Lantern>().Fuel < 950)
                    {
                        refillText.SetActive(true);
                        if (Input.GetKeyDown("r"))
                        {
                            OilHolder.HoldingNow--;
                            objHit.GetComponent <Lantern>().Fuel += 900f;
                            OilHolder.Save();
                            objHit.GetComponent <Lantern>().SaveSettings();
                        }
                    }
                }
                else
                {
                    refillText.SetActive(false);
                }

                if (objHit.GetComponent <Lantern>().toggled == true)
                {
                    LampStatus.text  = "Active";
                    LampStatus.color = Color.green;
                }
                if (objHit.GetComponent <Lantern>().toggled == false)
                {
                    if (objHit.GetComponent <Lantern>().Fuel >= 1.5f)
                    {
                        LampStatus.text  = "Off";
                        LampStatus.color = Color.yellow;
                    }
                    else
                    {
                        LampStatus.text  = "Out of fuel";
                        LampStatus.color = Color.red;
                    }
                }

                if (Input.GetKeyDown("e"))
                {
                    if (objHit.GetComponent <Lantern>().Fuel >= 1f)
                    {
                        objHit.GetComponent <Lantern>().Toggle();
                        objHit.GetComponent <Lantern>().SaveSettings();
                    }
                }
            }
        }
    }
        public void RefreshSpotlight()
        {
            List <News> AllNews = _newsDAL.NewsList();
            int         x       = 0;

            News NewsTop   = new News();
            News NewsLeft  = new News();
            News NewsMid   = new News();
            News NewsRight = new News();

            foreach (News n in AllNews)
            {
                if (n.Date >= DateTime.Now.AddDays(-3))
                {
                    n.Views = _newsDAL.getNewsViews(n.Id);
                }
            }

            x       = AllNews.Max(n => n.Views);
            NewsTop = AllNews.Find(n => n.Views == x);
            AllNews.Remove(NewsTop);

            x        = AllNews.Max(n => n.Views);
            NewsLeft = AllNews.Find(n => n.Views == x);
            AllNews.Remove(NewsLeft);

            x       = AllNews.Max(n => n.Views);
            NewsMid = AllNews.Find(n => n.Views == x);
            AllNews.Remove(NewsMid);

            x         = AllNews.Max(n => n.Views);
            NewsRight = AllNews.Find(n => n.Views == x);


            //foreach (News n in AllNews)
            //{
            //    if (n.Date >= DateTime.Now.AddDays(-3))
            //    {
            //        n.Views = _newsDAL.getNewsViews(n.Id);

            //        if (NewsTop.Views < n.Views)
            //        {

            //            NewsTop = n;
            //        }
            //        else
            //        {
            //            if (NewsLeft.Views < n.Views)
            //            {
            //                NewsLeft = n;
            //            }
            //            else
            //            {
            //                if (NewsMid.Views < n.Views)
            //                {
            //                    NewsMid = n;
            //                }
            //                else
            //                {
            //                    if (NewsRight.Views < n.Views)
            //                    {
            //                        NewsRight = n;
            //                    }
            //                }
            //            }
            //        }
            //    }
            //}

            _SpotlightDAL.SpotlightClean();

            Spotlight SpotTop   = new Spotlight("3", "2", NewsTop.Img, NewsTop.Title, "http://mixturadosneo.com/news?id_news=" + NewsTop.Id, "News");
            Spotlight SpotLeft  = new Spotlight("1", "1", NewsLeft.Img, NewsLeft.Title, "http://mixturadosneo.com/news?id_news=" + NewsLeft.Id, "News");
            Spotlight SpotMid   = new Spotlight("1", "1", NewsMid.Img, NewsMid.Title, "http://mixturadosneo.com/news?id_news=" + NewsMid.Id, "News");
            Spotlight SpotRight = new Spotlight("1", "1", NewsRight.Img, NewsRight.Title, "http://mixturadosneo.com/news?id_news=" + NewsRight.Id, "News");

            _SpotlightDAL.SpotlightCreate(SpotTop);
            _SpotlightDAL.SpotlightCreate(SpotLeft);
            _SpotlightDAL.SpotlightCreate(SpotMid);
            _SpotlightDAL.SpotlightCreate(SpotRight);
        }
Esempio n. 25
0
        public ShadowSample(Microsoft.Xna.Framework.Game game)
            : base(game)
        {
            SampleFramework.IsMouseVisible = false;
            _graphicsScreen = new DeferredGraphicsScreen(Services)
            {
                // For debugging: Disable materials and only show light buffer.
                DebugMode = DeferredGraphicsDebugMode.VisualizeDiffuseLightBuffer
            };
            _graphicsScreen.DrawReticle = true;
            GraphicsService.Screens.Insert(0, _graphicsScreen);

            GameObjectService.Objects.Add(new DeferredGraphicsOptionsObject(Services));

            Services.Register(typeof(DebugRenderer), null, _graphicsScreen.DebugRenderer);
            Services.Register(typeof(IScene), null, _graphicsScreen.Scene);

            // Add gravity and damping to the physics simulation.
            Simulation.ForceEffects.Add(new Gravity());
            Simulation.ForceEffects.Add(new Damping());

            // Add a custom game object which controls the camera.
            var cameraGameObject = new CameraObject(Services);

            GameObjectService.Objects.Add(cameraGameObject);
            _graphicsScreen.ActiveCameraNode = cameraGameObject.CameraNode;

            GameObjectService.Objects.Add(new GrabObject(Services));

            CreateScene(Services, ContentManager, _graphicsScreen);

            // Disable existing lights.
            foreach (var lightNode in _graphicsScreen.Scene.GetDescendants().OfType <LightNode>())
            {
                lightNode.IsEnabled = false;
            }

            // Add a dim ambient light.
            _graphicsScreen.Scene.Children.Add(
                new LightNode(
                    new AmbientLight
            {
                HemisphericAttenuation = 1,
                Intensity = 0.001f,
            }));

            // Add some test lights with shadows.
            _spotlight = new Spotlight {
                Range = 10, FalloffAngle = 0.8f, CutoffAngle = 1f
            };
            _standardShadow = new StandardShadow();
            _spotlightNode  = new LightNode(_spotlight)
            {
                PoseWorld = new Pose(new Vector3(0, 1f, -2)),
                Shadow    = _standardShadow,
                IsEnabled = true,
            };
            _graphicsScreen.Scene.Children.Add(_spotlightNode);

            _cubeMapShadow = new CubeMapShadow();
            _pointLight    = new PointLight {
                Range = 10,
            };
            _pointLightNode = new LightNode(_pointLight)
            {
                PoseWorld = new Pose(new Vector3(0, 1f, -2)),
                Shadow    = _cubeMapShadow,
                IsEnabled = false,
            };
            _graphicsScreen.Scene.Children.Add(_pointLightNode);

            CreateGuiControls();
        }
 public void Dispose()
 {
     Spotlight.Dispose();
     Camera.Dispose();
 }
        //
        // GET: /Home/ChampsPreview
        public ActionResult SpotlightUpdate(int id_spotlight)
        {
            Spotlight s = _spotlightBLL.SpotlightSelect(id_spotlight);

            return(View("SpotlightUpdate", s));
        }
        public void loadSpotlightdata(Guid AccessCode)
        {
            // school data
            Spotlight spotlight;

            spotlight = Spotlight.Select(AccessCode);

            if (spotlight != null)
            {
                Awards.Text       = string.IsNullOrEmpty(spotlight.Awards) ? string.Empty : spotlight.Awards;
                Achievements.Text = string.IsNullOrEmpty(spotlight.Achievements) ? string.Empty : spotlight.Achievements;
                CurentGPA.Text    = string.IsNullOrEmpty(spotlight.CurentGPA) ? string.Empty : spotlight.CurentGPA;
                Involvments.Text  = string.IsNullOrEmpty(spotlight.Involvments) ? string.Empty : spotlight.Involvments;

                if (spotlight.OraganizationId.HasValue)
                {
                    Oraganization oraganization;
                    oraganization = Generic.Get <Oraganization>(spotlight.OraganizationId.Value);
                    if (oraganization != null)
                    {
                        txtOraganizations.Text = oraganization.OraganizationName;
                    }
                }

                if (spotlight.FraternityId.HasValue)
                {
                    Fraternity fraternity;
                    fraternity = Generic.Get <Fraternity>(spotlight.FraternityId.Value);
                    if (fraternity != null)
                    {
                        txtFraternity.Text = fraternity.FraternityName;
                    }
                }

                if (spotlight.SoroityId.HasValue)
                {
                    Soroity soroity;
                    soroity = Generic.Get <Soroity>(spotlight.SoroityId.Value);
                    if (soroity != null)
                    {
                        txtSoroity.Text = soroity.SoroityName;
                    }
                }

                if (spotlight.GreakOrganizationId.HasValue)
                {
                    GreakOrganization greakOrganization;
                    greakOrganization = Generic.Get <GreakOrganization>(spotlight.GreakOrganizationId.Value);
                    if (greakOrganization != null)
                    {
                        txyGreakOrganization.Text = greakOrganization.GreakOrganizationName;
                    }
                }

                if (spotlight.GreekHonorSocitiesId.HasValue)
                {
                    GreekHonorSocities greekHonorSocities;
                    greekHonorSocities = Generic.Get <GreekHonorSocities>(spotlight.GreekHonorSocitiesId.Value);
                    if (greekHonorSocities != null)
                    {
                        txtGreekHonorSocities.Text = greekHonorSocities.GreekHonorSocitiesName;
                    }
                }
            }
        }