Inheritance: MonoBehaviour
Esempio n. 1
0
        public Entity CreateFromAsset(object asset)
        {
            Entity entity = null;

            if (asset is Model)
            {
                Model model = asset as Model;

                if (model.Tag is SkinningData)
                {
                    entity = new AnimatedModelEntity(model);
                }
                else
                {
                    entity = new StaticModelEntity(model);
                }
            }
            else if (asset is Texture2D)
            {
                Texture2D texture = asset as Texture2D;
                entity = new Billboard(texture);
            }

            return(entity);
        }
Esempio n. 2
0
        public override void UpdateRenderQueue(RenderQueue queue, List <Particle> currentParticles, bool cullIndividually)
        {
            this.billboardSet.CullIndividual = cullIndividually;

            // Update billboard set geometry
            this.billboardSet.BeginBillboards();
            var bb = new Billboard();

            foreach (var p in currentParticles)
            {
                bb.Position = p.Position;
                if (this.billboardSet.BillboardType == BillboardType.OrientedSelf ||
                    this.billboardSet.BillboardType == BillboardType.PerpendicularSelf)
                {
                    // Normalise direction vector
                    bb.Direction = p.Direction;
                    bb.Direction.Normalize();
                }
                bb.Color             = p.Color;
                bb.rotationInRadians = p.rotationInRadians;
                bb.HasOwnDimensions  = p.HasOwnDimensions;
                if (bb.HasOwnDimensions)
                {
                    bb.width  = p.Width;
                    bb.height = p.Height;
                }
                this.billboardSet.InjectBillboard(bb);
            }

            this.billboardSet.EndBillboards();

            // Update the queue
            this.billboardSet.UpdateRenderQueue(queue);
        }
Esempio n. 3
0
        private void InitBillboard()
        {
            if (fBillboard1 == null)
            {
                fBillboard1 = new Billboard(GraphicsDevice);
                fBillboard2 = new Billboard(GraphicsDevice);
                fBillboard3 = new Billboard(GraphicsDevice);
            }
            else
            {
                fBillboard1.Clear();
                fBillboard2.Clear();
                fBillboard3.Clear();
            }
            fBillboard1.Mode = fBillboard2.Mode = fBillboard3.Mode = fDrawMode;

            foreach (MyPoint point in fPoints)
            {
                Color color = Color.White;
                switch (point.TextureIndex)
                {
                case 0:
                    fBillboard1.AddObject(point.Position, color, point.Size);
                    break;

                case 1:
                    fBillboard2.AddObject(point.Position, color, point.Size);
                    break;

                case 2:
                    fBillboard3.AddObject(point.Position, color, point.Size);
                    break;
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Builds a Billboard object
        /// </summary>
        public void Show()
        {
            if (mBillboard == null)
            {
                StyledQuad cardBackground = new StyledQuad
                                            (
                    "Quad",
                    GameFacade.Instance.RetrieveMediator <FashionGameGui>().GetNamedStyle(StyleName)
                                            );

                FashionCameraMediator cameraMediator = GameFacade.Instance.RetrieveMediator <FashionCameraMediator>();

                Billboard billboard = new Billboard();
                billboard.BillboardGameObject.layer = FashionMinigame.CLOTHING_LAYER;
                Material billboardMat = new Material(Shader.Find("GUI/Flat Color"));
                billboardMat.mainTexture = this.NormalTexture;
                billboard.SetMaterial(billboardMat);
                billboard.BillboardToCamera(cameraMediator.Camera);

                // Hard coded values: a bunch of them
                cardBackground.Size                    = new Vector2(4.0f, 4.0f);
                cardBackground.Transform.parent        = billboard.Transform;
                cardBackground.Transform.localPosition = new Vector3(-1.1f, 1.1f, -0.05f);
                cardBackground.Transform.localScale    = new Vector3(BILLBOARD_ASPECT_RATIO, 1.0f, 1.0f) * 0.55f;
                cardBackground.Transform.localRotation = Quaternion.Euler(90.0f, 0.0f, 0.0f);

                mBillboard = new Pair <Billboard, StyledQuad>(billboard, cardBackground);
                SetBillboardSize(BILLBOARD_SIZE);
            }
        }
 public static void performHoverAction_Postfix(ref Billboard __instance, int x, int y, ref string ___hoverText)
 {
     if (__instance.calendarDays != null && Game1.player.eventsSeen.Contains(BEARS_KNOWLEDGE_EVENT))
     {
         for (int i = 0; i < __instance.calendarDays.Count; i++)
         {
             ClickableTextureComponent c = __instance.calendarDays[i];
             if (c.bounds.Contains(x, y))
             {
                 if (Game1.currentSeason.Equals("fall") && i >= 7 && i <= 10)
                 {
                     if (___hoverText.Length > 0)
                     {
                         ___hoverText += Environment.NewLine;
                     }
                     ___hoverText += "Blackberry Season";
                 }
                 if (Game1.currentSeason.Equals("spring") && i >= 14 && i <= 17)
                 {
                     if (___hoverText.Length > 0)
                     {
                         ___hoverText += Environment.NewLine;
                     }
                     ___hoverText += "Salmonberry Season";
                 }
             }
         }
     }
 }
Esempio n. 6
0
        public MovableText(string name, SceneManager sceneMgr, SceneNode node, Size size)
        {
            this.texture = TextureManager.Singleton.CreateManual(
                name + "Texture",
                ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                TextureType.TEX_TYPE_2D,
                (uint)size.Width,
                (uint)size.Height,
                0,
                PixelFormat.PF_A8R8G8B8);

            this.material = MaterialManager.Singleton.Create(name + "Material", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
            this.material.GetTechnique(0).GetPass(0).CreateTextureUnitState(this.texture.Name);
            this.material.SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA);
            this.material.SetDepthCheckEnabled(false);

            this.billboardSet = sceneMgr.CreateBillboardSet();
            this.billboardSet.SetMaterialName(this.material.Name);
            this.billboardSet.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY;

            this.billboard = this.billboardSet.CreateBillboard(Vector3.ZERO);
            this.billboard.SetDimensions(size.Width, size.Height);
            this.billboard.Colour = ColourValue.ZERO;

            node.AttachObject(this.billboardSet);
            this.sceneMgr = sceneMgr;
            this.size     = size;
        }
        private static void Billboard_draw_Postfix(Billboard __instance, Texture2D ___billboardTexture, bool ___dailyQuestBoard, SpriteBatch b)
        {
            if (___dailyQuestBoard)
            {
                return;
            }
            int add = Game1.dayOfMonth / 28 * 28;

            for (int i = 0; i < __instance.calendarDays.Count; i++)
            {
                if (Game1.dayOfMonth > add + i + 1)
                {
                    b.Draw(Game1.staminaRect, __instance.calendarDays[i].bounds, Color.Gray * 0.25f);
                }
                else if (Game1.dayOfMonth == add + i + 1)
                {
                    int offset = (int)(4f * Game1.dialogueButtonScale / 8f);
                    IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(379, 357, 3, 3), __instance.calendarDays[i].bounds.X - offset, __instance.calendarDays[i].bounds.Y - offset, __instance.calendarDays[i].bounds.Width + offset * 2, __instance.calendarDays[i].bounds.Height + offset * 2, Color.Blue, 4f, false, -1f);
                }
                else if (i + add >= Config.DaysPerMonth)
                {
                    b.Draw(Game1.staminaRect, __instance.calendarDays[i].bounds, Color.White);
                }
            }
        }
Esempio n. 8
0
        void Start()
        {
            billboard = GetComponentInChildren <Billboard> ();
            Debug.Assert(billboard != null);
            blockComponent = GetComponentInChildren <BlockComponent> ();
            Debug.Assert(blockComponent != null);

            if (blockComponent.surface != null)
            {
                var planet = Game.Instance.Planet;
                surfaces = new List <Surface> (planet.Terrian.FindSurfaces(blockComponent.surface, 5.0f));

                var num = 7;
                for (var i = 0; i < num; i++)
                {
                    if (surfaces.Count == 0)
                    {
                        break;
                    }
                    var index   = UnityEngine.Random.Range(0, surfaces.Count - 1);
                    var surface = surfaces [index];
                    surfaces.RemoveAt(index);

                    planet.Create(Prefabs.Swordsman, surface);
                }
            }
        }
Esempio n. 9
0
        public ActionResult Create([Bind(Include = "Id,Name,Location,Latitude,Longitude,AdFlowchartDiagramData")] Billboard billboard, int?id, string modelType)
        {
            string controllerName = "";

            if (ModelState.IsValid)
            {
                db.Billboards.Add(billboard);
                db.SaveChanges();
                logger.Log("Billboards/Create - BillboardId:" + billboard.Id.ToString());
                if (modelType != null && modelType.Length > 0)
                {
                    if (modelType.Contains("Ad"))
                    {
                        db.Ads.Find(id).Billboards.Add(billboard);
                        db.SaveChanges();
                        logger.Log("Billboards/Create added - BillboardId:" + billboard.Id.ToString() + " to AdId: " + id.ToString());
                        controllerName = "Ads";
                    }
                    return(RedirectToAction("Details", controllerName, new { Id = id }));
                }
                return(RedirectToAction("Index"));
            }

            return(View(billboard));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="position"></param>
        /// <param name="xScale"></param>
        /// <param name="yScale"></param>
        /// <param name="color"></param>
        /// <param name="texcoordIndexU"></param>
        /// <param name="texcoordsIndexV"></param>
        public void CreateBillboard(Vector3 position, float xScale, float yScale, ColorEx color, short texcoordIndexU, short texcoordsIndexV)
        {
            if (mRenderMethod == BillboardMethod.Accelerated)
            {
                StaticBillboard bb = new StaticBillboard();
                bb.Position        = position;
                bb.XScale          = xScale;
                bb.YScale          = yScale;
                bb.TextCoordIndexU = texcoordIndexU;
                bb.TextCoordIndexV = texcoordsIndexV;

                uint packedColor = (uint)Root.Singleton.RenderSystem.ConvertColor(color);
                bb.Color = packedColor;
                mBillboardBuffer.Add(bb);
            }
            else
            {
                Billboard bb = mFallbackSet.CreateBillboard(position);
                bb.SetDimensions(xScale, yScale);
                bb.TexcoordRect = new RectangleF(
                    texcoordIndexU * mUFactor,
                    texcoordsIndexV * mVFactor,
                    (texcoordIndexU + 1) * mUFactor,
                    (texcoordsIndexV + 1) * mVFactor);

                bb.Color = color;
            }
        }
Esempio n. 11
0
    void Start()
    {
        agent  = GetComponent <NavMeshAgent>();
        anim   = GetComponent <Animator>();
        health = GetComponent <HealthObject>();

        Billboard stats = Instantiate(statsPrefab, transform.position, Quaternion.identity).GetComponent <Billboard>();

        health.healthSlider = stats.GetComponent <Slider>();
        health.speedText    = stats.transform.Find("Speed").GetComponent <Text>();
        health.defenseText  = stats.transform.Find("Defense").GetComponent <Text>();
        health.strengthText = stats.transform.Find("Strength").GetComponent <Text>();
        stats.target        = transform;
        stats.transform.SetParent(canvasParent, false);

        health.toDestroy.Add(stats.gameObject);

        health.strengthMultiplier = strengthMultipler;
        health.speedMultiplier    = speedMultiplier;
        health.defenseMultiplier  = defenseMultipler;
        health.strength           = baseDamage * strengthMultipler;
        health.speed   = baseSpeed * speedMultiplier;
        health.defense = baseProtection * defenseMultipler;

        agent.speed = health.speed;
    }
Esempio n. 12
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     SpriteBatchHelpers.Initialize(this.GraphicsDevice);
     Billboard.Initialize(this.GraphicsDevice, Content.Load <Effect>("Shaders/Billboarding"));
 }
Esempio n. 13
0
        protected static GameObject InitMenu()
        {
            GameObject menu = GameObject.Find(ForgeConstants.MENUPATH);

            if (menu == null)
            {
                menu       = new GameObject(ForgeConstants.MENU, typeof(Billboard));
                menu.layer = LayerMask.NameToLayer(ForgeConstants.MENUITEMS);

                Billboard billboard = menu.GetComponent <Billboard> () as Billboard;
                billboard.PivotAxis = PivotAxis.Y;

                GameObject textObj = new GameObject(ForgeConstants.MENU + " Text", typeof(MeshRenderer));
                textObj.transform.parent        = menu.transform;
                textObj.transform.localScale    = new Vector3(.01f, .01f, .01f);
                textObj.transform.localPosition = new Vector3(0f, .07f, 0f);

                TextMesh text = textObj.AddComponent <TextMesh> ();
                text.text      = "Hello World !";
                text.color     = Color.white;
                text.tabSize   = 4;
                text.richText  = true;
                text.alignment = TextAlignment.Left;
            }
            return(menu);
        }
Esempio n. 14
0
    public int CompareByDistance2(Billboard a, Billboard b)
    {
        var adist = (a.Position - Camera.transform.position).sqrMagnitude;
        var bdist = (b.Position - Camera.transform.position).sqrMagnitude;

        return(adist.CompareTo(bdist));
    }
Esempio n. 15
0
        public LightWibbler(Light light, Billboard billboard, Color minColour,
                            Color maxColour, float minSize, float maxSize)
            : base()
        {
            mCVFH = new ControllerValueFloatDirector();
            mCVFH.SubscribeEvents();
            mCVFH.GetValueFunction += new CVFHGetValueDelegate(GetValue);
            mCVFH.SetValueFunction += new CVFHSetValueDelegate(SetValue);

            mLight       = light;
            mBillboard   = billboard;
            mColourRange = new OgreDotNet.ColourValue();
            mHalfColour  = new OgreDotNet.ColourValue();

            mColourRange.r = ((maxColour.R - minColour.R) / 255.0f) * 0.5f;
            mColourRange.g = ((maxColour.G - minColour.G) / 255.0f) * 0.5f;
            mColourRange.b = ((maxColour.B - minColour.B) / 255.0f) * 0.5f;

            mHalfColour.r = Converter.ToColourValue(minColour).r + mColourRange.r;
            mHalfColour.g = Converter.ToColourValue(minColour).g + mColourRange.g;
            mHalfColour.b = Converter.ToColourValue(minColour).b + mColourRange.b;

            mMinSize   = minSize;
            mSizeRange = maxSize - minSize;
            intensity  = 1;
        }
Esempio n. 16
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            this.Services.AddService(typeof(SpriteBatch), spriteBatch);
            DiagnosticsManager.Initialize(this);
            SpriteBatchHelpers.Initialize(GraphicsDevice);
            Primitives.Initialize(GraphicsDevice);
            Billboard.Initialize(GraphicsDevice, Content.Load <Effect>("Shaders/Billboarding"));

            // TODO: use this.Content to load your game content here
            CreateSpheres();

            ship      = new Ship(this);
            followCam = new FollowCamera(camera, ship);

            lightningTexture = new LightningTexture(GraphicsDevice, 50, 100);

            #region Particles
            pSet = new ParticleSettings()
            {
                BlendState                 = BlendState.Additive,
                MaxParticles               = 10,
                Duration                   = TimeSpan.FromSeconds(0.5),
                DurationRandomness         = 0.1f,
                EmitterVelocitySensitivity = 0,
                MinVelocity                = 1f,
                MaxVelocity                = 2f,
                Gravity        = Vector3.Zero,
                EndVelocity    = 0,
                MinColor       = Color.White,
                MaxColor       = Color.White,
                MinRotateSpeed = -0.1f,
                MaxRotateSpeed = 0.1f,
                MinStartSize   = 0.25f,
                MaxStartSize   = 0.35f,
                MinEndSize     = 0.5f,
                MaxEndSize     = 0.6f
            };

            var pTex = new Texture2D(GraphicsDevice, 5, 5);
            pTex.SetData(Enumerable.Repeat(Color.FromNonPremultiplied(0, 0, 255, 125), 25).ToArray());

            var pEff = Content.Load <Effect>("Shaders/Particles");

            pSys = new ParticleSystem(this, pSet, pTex, pEff, camera);
            pEmi = new ParticleEmitter(pSys)
            {
                Position = Vector3.UnitX, ParticlesPerSecond = 10
            };
            pEmi2 = new ParticleEmitter(pSys)
            {
                Position = -Vector3.UnitX, ParticlesPerSecond = 10
            };
            //pEmi = new ParticleEmitter(pSys) { Position = Vector3.UnitY, ParticlesPerSecond = 10 };
            //pEmi = new ParticleEmitter(pSys) { Position = new Vector3(Vector2.One, 0), ParticlesPerSecond = 10 };
            #endregion

            base.LoadContent();
        }
Esempio n. 17
0
        private void InitBillboard()
        {
            fBillboardChanged = false;
            if (fBillboard == null)
            {
                fBillboard = new Billboard(GraphicsDevice);
            }
            else
            {
                fBillboard.Clear();
            }
            fBillboard.UseVertexBuffer = fUseVertexBuffer;

            foreach (MyPoint point in fPoints)
            {
                Color   color     = Color.White;
                Vector3 direction = point.Direction;
                int     r         = (byte)(128 + 127 * direction.X);
                int     g         = (byte)(128 + 127 * direction.Y);
                int     b         = (byte)(128 + 127 * direction.Z);
                color = new Color(r, g, b, 255);

                fBillboard.AddObject(point.Position, color, point.Size);
            }
        }
Esempio n. 18
0
 /// <summary>
 /// Main billboard controller (true if billboard displayed for an advertisement, etc., false for a simple turn display)
 /// </summary>
 public void RunBillboard(bool isBillboard)
 {
     /*string displayText = GameManager.i.newsScript.GetAdvert();*/
     if (isBillboard == true)
     {
         //full billboard display
         Billboard billboard = GameManager.i.dataScript.GetRandomBillboard();
         if (billboard != null)
         {
             Debug.LogFormat("[UI] BillboardUI.cs -> RunBillboard: Start BillboardMain with \"{0}\" display{1}", billboard.name, "\n");
             myCoroutine = StartCoroutine("BillOpenMain", billboard);
         }
         else
         {
             Debug.LogWarning("Invalid billboard (Null)");
         }
     }
     else
     {
         //normal turn display
         int dayNum = GameManager.i.turnScript.Turn;
         Debug.LogFormat("[UI] BillboardUI.cs -> RunBillboard: Start BillboardTurn for Day {0} display{1}", dayNum, "\n");
         myCoroutine = StartCoroutine("BillOpenTurn", dayNum);
     }
 }
Esempio n. 19
0
        public IHttpActionResult AddAdToBillboard(int BillboardId, int AdId)
        {
            Billboard billboard = db.Billboards.Find(BillboardId);
            Ad        ad        = db.Ads.Find(AdId);

            if (billboard != null && ad != null)
            {
                try
                {
                    billboard.Ads.Add(ad);
                    db.Entry(billboard).State = EntityState.Modified;
                    db.SaveChanges();
                    logger.Log("api/AddAdToBillboard - BillboardId:" + billboard.Id.ToString() + " AdId:" + ad.Id.ToString());
                }
                catch
                {
                    throw;
                }
            }
            else
            {
                return(NotFound());
            }
            return(StatusCode(HttpStatusCode.NoContent));
        } // AddAdToBillboard
Esempio n. 20
0
 void Start()
 {
     blockComponent = GetComponent <BlockComponent> ();
     Debug.Assert(blockComponent != null);
     billboard = GetComponentInChildren <Billboard> ();
     Debug.Assert(billboard != null);
 }
Esempio n. 21
0
    /// <summary>
    /// Takes textTop from billboard and converts any '[' and ']' tags (topText only) into textmeshPro tags
    /// </summary>
    /// <param name="text"></param>
    /// <returns></returns>
    private string ProcessBillboardTextTop(Billboard billboard)
    {
        string checkedText = "Unknown";
        string startTag;

        //normally a blue highlight but can be red. Always upsized
        if (billboard.isRedHighlight == true)
        {
            startTag = string.Format("{0}{1}", sizeLarge, colourRed);
        }
        else
        {
            startTag = string.Format("{0}{1}", sizeLarge, colourBlue);
        }
        //switch to Caps
        string text = billboard.textTop.ToUpper();

        //replace tags
        if (string.IsNullOrEmpty(text) == false)
        {
            string tempText = text.Replace("[", startTag);
            checkedText = tempText.Replace("]", endTag);
        }
        return(checkedText);
    }
Esempio n. 22
0
    public GameObject CreateBillboard(string path, string name, bool usingHDRP)
    {
        GameObject camObject = Instantiate(Resources.Load("Mtree/MtreeBillboardCamera") as GameObject); // create billboard and render it
        Camera     cam       = camObject.GetComponent <Camera>();
        Billboard  bill      = new Billboard(cam, gameObject, 512, 512);

        bill.SetupCamera();
        string texturePath = path + name + "_billboard.png";

        bill.Render(texturePath);
        DestroyImmediate(camObject);

        Mesh billboardMesh = bill.CreateMesh(); // create billboard mesh

        AssetDatabase.CreateAsset(billboardMesh, path + name + "_LOD4.mesh");

        GameObject billboard  = new GameObject(name + "_LOD4"); // create billboard object and assign mesh
        MeshFilter meshFilter = billboard.AddComponent <MeshFilter>();

        meshFilter.mesh = billboardMesh;
        MeshRenderer meshRenderer = billboard.AddComponent <MeshRenderer>();

        Texture  billboardTexture = (Texture2D)AssetDatabase.LoadAssetAtPath(texturePath, typeof(Texture2D)); // create material
        Material mat = bill.CreateMaterial(billboardTexture, usingHDRP);

        meshRenderer.sharedMaterial = mat;
        AssetDatabase.CreateAsset(mat, path + name + "billboard.mat");
        return(billboard);
    }
Esempio n. 23
0
    protected override void InitializeVisualMembers() {
        var meshRenderer = gameObject.GetFirstComponentInImmediateChildrenOnly<MeshRenderer>();
        meshRenderer.castShadows = false;
        meshRenderer.receiveShadows = false;
        meshRenderer.enabled = true;

        var glowRenderers = gameObject.GetComponentsInChildren<MeshRenderer>().Except(meshRenderer);
        glowRenderers.ForAll(gr => {
            gr.castShadows = false;
            gr.receiveShadows = false;
            gr.enabled = true;
        });

        var starLight = gameObject.GetComponentInChildren<Light>();
        starLight.range = GameManager.GameSettings.UniverseSize.Radius();
        starLight.intensity = 0.5F;
        starLight.cullingMask = _starLightCullingMask;
        starLight.enabled = true;

        _billboard = gameObject.GetSafeFirstMonoBehaviourInChildren<Billboard>();
        _billboard.enabled = true;

        var animation = gameObject.GetComponentInChildren<Animation>();
        animation.cullingType = AnimationCullingType.BasedOnRenderers; // aka, disabled when not visible
        animation.enabled = true;
        //TODO animation settings and distance controls

        var revolvers = gameObject.GetSafeMonoBehavioursInChildren<Revolver>();
        revolvers.ForAll(r => r.enabled = true);
        //TODO Revolver settings and distance controls, Revolvers control their own enabled state based on visibility

        var cameraLosChgdListener = gameObject.GetSafeFirstMonoBehaviourInChildren<CameraLosChangedListener>();
        cameraLosChgdListener.onCameraLosChanged += (go, inCameraLOS) => InCameraLOS = inCameraLOS;
        cameraLosChgdListener.enabled = true;
    }
Esempio n. 24
0
    void OnCapturedPhotoToDisk(PhotoCapture.PhotoCaptureResult result)
    {
        if (result.success)
        {
            Debug.Log("Saved Photo to disk!");
            photoCaptureObject.StopPhotoModeAsync(OnStoppedPhotoMode);

            GameObject photoFrame = GameObject.CreatePrimitive(PrimitiveType.Quad);

            photoFrame.transform.position = Camera.main.transform.position + Camera.main.transform.forward * 3f;
            new Vector3(.5f, 0.3f, 1f);
            Texture2D texture  = new Texture2D(1, 1);
            Renderer  renderer = photoFrame.GetComponent <Renderer>();
            byte[]    imageData;
            imageData = System.IO.File.ReadAllBytes(filePath);
            texture.LoadImage(imageData);
            renderer.material.mainTexture = texture;

            Billboard b = photoFrame.AddComponent <Billboard>();
            //b.PivotAxis = PivotAxis.Y;

            //TapToPlace t = photoFrame.AddComponent<TapToPlace>();
        }
        else
        {
            Debug.Log("Failed to save Photo to disk");
        }
    }
Esempio n. 25
0
        private Billboard CreateControlBodyView2(ControlInfo c, ControlInfo root)
        {
            var left   = c.Position.X / root.Size.Width;
            var top    = c.Position.Y / root.Size.Height;
            var right  = left + c.Size.Width / root.Size.Width;
            var bottom = top + c.Size.Height / root.Size.Height;

            left   *= 5;
            top    *= 5;
            right  *= 5;
            bottom *= 5;

            var hw = 2.5;
            var hh = 2.5;

            left   -= hw;
            right  -= hw;
            top    -= hh;
            bottom -= hh;

            var frame = new Billboard
            {
                LowerLeft  = new Point3D(left, -bottom, c.Depth * 0.2),
                LowerRight = new Point3D(right, -bottom, c.Depth * 0.2),
                UpperLeft  = new Point3D(left, -top, c.Depth * 0.2),
                UpperRight = new Point3D(right, -top, c.Depth * 0.2),
                Material   = new DiffuseMaterial(new ImageBrush
                {
                    ImageSource = LoadImage(c.TexturePath)
                }),
            };

            return(frame);
        }
Esempio n. 26
0
    private void sendBillboard(Client cl, Billboard bb)
    {
        object[] args = new object[6 + bb.Arguments.Count * 2];
        // id, pos, rot, scale, argc, args*2
        // 5 + args*2

        args[0] = bb.Id;
        args[1] = bb.Position;
        args[2] = bb.Rotation;
        args[3] = bb.Scale;
        args[4] = bb.Type;
        args[5] = bb.Arguments.Count;

        int counter = 6;

        foreach (var pair in bb.Arguments)
        {
            args[counter]     = pair.Key;
            args[counter + 1] = pair.Value;

            counter += 2;
        }

        cl.triggerEvent("CREATE_BILLBOARD", args);
    }
Esempio n. 27
0
        public IHttpActionResult RemoveBillboardFromAd(int AdId, int BillboardId)
        {
            Ad        ad        = db.Ads.Find(AdId);
            Billboard billboard = db.Billboards.Find(BillboardId);

            if (ad != null && billboard != null)
            {
                try
                {
                    ad.Billboards.Remove(billboard);
                    db.Entry(ad).State = EntityState.Modified;
                    db.SaveChanges();
                    logger.Log("api/RemoveBillboardToAd - AdId:" + ad.Id.ToString() + " BillboardId:" + billboard.Id.ToString());
                }
                catch
                {
                    throw;
                }
            }
            else
            {
                return(NotFound());
            }
            return(StatusCode(HttpStatusCode.NoContent));
        } // RemoveBillboardFromAd
Esempio n. 28
0
File: Tree.cs Progetto: lvarvel/aura
        internal TreeBranch(float c_length, float angleClamp, float dropOff, int number,
            Vector3 normal, Vector3 position, int depthCounter, Billboard b, TreeBranch parent, Tree root)
        {
            List<Vector3> points = new List<Vector3>();
            Position = position;
            Parent = parent;
            Root = root;
            for (int i = 0; i < number; ++i)
            {
                if (depthCounter > 0)
                    points.Add(getNext(c_length, angleClamp, normal) + position);
                else
                    points.Add(getNext(c_length, angleClamp, normal) * 0.5f + position);
            }

            if (depthCounter > 0)
            {
                foreach(Vector3 point in points)
                {
                    Children.Add(new TreeBranch(c_length * dropOff, angleClamp, dropOff, number,
                        (point - position).normalize(), point, depthCounter-1, b, this, root));
                }
            }
            else
            {
                foreach(Vector3 leaf in points)
                {
                    Children.Add(new TreeLeaf(leaf, b, this, root));
                }
            }
        }
Esempio n. 29
0
        private Billboard CreateControlBodyView(ControlInfo c, ControlInfo root)
        {
            var left   = c.Position.X / root.Size.Width;
            var top    = c.Position.Y / root.Size.Height;
            var right  = left + c.Size.Width / root.Size.Width;
            var bottom = top + c.Size.Height / root.Size.Height;

            left   *= 5;
            top    *= 5;
            right  *= 5;
            bottom *= 5;

            var hw = 2.5;
            var hh = 2.5;

            left   -= hw;
            right  -= hw;
            top    -= hh;
            bottom -= hh;

            var frame = new Billboard
            {
                LowerLeft  = new Point3D(left, -bottom, c.Depth * 0.2),
                LowerRight = new Point3D(right, -bottom, c.Depth * 0.2),
                UpperLeft  = new Point3D(left, -top, c.Depth * 0.2),
                UpperRight = new Point3D(right, -top, c.Depth * 0.2),
                Content    = new AmbientLight(Colors.White)
            };

            return(frame);
        }
Esempio n. 30
0
 public ActionResult Create(Billboard b)
 {
     if (Session["Username"] != null)
     {
         ViewBag.logueado = Session["Username"];
         if (ModelState.IsValid)
         {
             try
             {
                 // TODO: Add insert logic here
                 b.films = new List <string>();
                 billboardCollection.InsertOne(b);
                 return(RedirectToAction("Index"));
             }
             catch
             {
                 return(View());
             }
         }
         else
         {
             return(View());
         }
     }
     return(View());
 }
Esempio n. 31
0
 Billboard getBillboard()
 {
     if (billboard == null)
     {
         bool      found = false;
         Transform p     = transform.parent;
         while (!found)
         {
             if (p.GetComponent <Billboard>() != null)
             {
                 found = true;
             }
             else if (p.root.Equals(p))
             {
                 return(null);
             }
             else
             {
                 p = p.parent;
             }
         }
         billboard = p.GetComponent <Billboard>();
     }
     return(billboard);
 }
Esempio n. 32
0
        public IHttpActionResult PutBillboard(int id, Billboard billboard)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != billboard.Id)
            {
                return(BadRequest());
            }

            db.Entry(billboard).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
                logger.Log("PUT: api/BillboardsData/ - BillboardId:" + billboard.Id.ToString());
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BillboardExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 33
0
        public MovableText(string name, SceneManager sceneMgr, SceneNode node, Size size)
        {
            this.texture = TextureManager.Singleton.CreateManual(
                name + "Texture",
                ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                TextureType.TEX_TYPE_2D,
                (uint)size.Width,
                (uint)size.Height,
                0,
                PixelFormat.PF_A8R8G8B8);

            this.material = MaterialManager.Singleton.Create(name + "Material", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
            this.material.GetTechnique(0).GetPass(0).CreateTextureUnitState(this.texture.Name);
            this.material.SetSceneBlending(SceneBlendType.SBT_TRANSPARENT_ALPHA);
            this.material.SetDepthCheckEnabled(false);

            this.billboardSet = sceneMgr.CreateBillboardSet();
            this.billboardSet.SetMaterialName(this.material.Name);
            this.billboardSet.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY;

            this.billboard = this.billboardSet.CreateBillboard(Vector3.ZERO);
            this.billboard.SetDimensions(size.Width, size.Height);
            this.billboard.Colour = ColourValue.ZERO;

            node.AttachObject(this.billboardSet);
            this.sceneMgr = sceneMgr;
            this.size = size;
        }
Esempio n. 34
0
        public override void Enter(Dictionary<string, object> data)
        {
            var localPlayer = Storage.NetworkSession.LocalGamers[0].Tag as LocalPlayer;

            if(localPlayer != null)
            {
                localPlayer.Phase = GamePhases.Phase1;
            }

            _tutorialSound = Storage.Sound("Tutorial").CreateInstance();
            Storage.InTutorial = true;
            Storage.TutorialLevel = 0;

            Cursor.Hide();
            _crosshair = new Crosshair(Game);
            Game.Components.Add(_crosshair);

            foreach(var gamer in Storage.NetworkSession.AllGamers)
            {
                Game.Components.Add((Player)gamer.Tag);
            }

            Game.Components.Add(Game.GameMap);

            if(localPlayer != null)
            {
                var centerSidebar = (Game.GameMap.Width + Game.BaseScreenSize.X) / 2.0f;

                _mobilityIcon = AddToolIconForTool(localPlayer.Mobility, centerSidebar - 20.0f - 148.0f, 10.0f + 148.0f);
                _weaponIcon = AddToolIconForTool(localPlayer.Weapon, centerSidebar, 10.0f + 148.0f);
                _utilityIcon = AddToolIconForTool(localPlayer.Utility, centerSidebar + 20.0f + 148.0f, 10.0f + 148.0f);
                _primaryAIcon = AddToolIconForTool(localPlayer.PrimaryA, centerSidebar - 10.0f - 74.0f,
                                                   (10.0f + 148.0f) * 2.0f);
                _primaryBIcon = AddToolIconForTool(localPlayer.PrimaryB, centerSidebar + 20.0f + 74.0f,
                                                   (10.0f + 148.0f) * 2.0f);

                _keyBindingIcon = new Billboard(Game, (int)centerSidebar, 400, Storage.Sprite("blank"))
                                  { PositionGravity = Gravity.Center };
                Game.Components.Add(_keyBindingIcon);

                if(_primaryBIcon != null)
                {
                    _primaryBIcon.Disabled = true;
                }

                _nameLabel = new Label(Game, centerSidebar, 2.0f,
                                       localPlayer.Gamer.Gamertag, "Calibri48Bold")
                             {
                                 PositionGravity =
                                     new Tuple<Gravity.Vertical, Gravity.Horizontal>(Gravity.Vertical.Top,
                                                                                     Gravity.Horizontal.Center)
                             };
                Game.Components.Add(_nameLabel);
            }

            Game.Components.Add(Storage.SandParticles);

            StartTimer();
        }
Esempio n. 35
0
 public DecayableBillboard(BillboardSet billboardSet, Vector3 position, Vector2 dimension, float timeToLive)
 {
     this.BillboardSet = billboardSet;
     Billboard = BillboardSet.CreateBillboard(position);
     Billboard.TexcoordRect = new FloatRect(0, 0, 1, 1);
     this.Dimension = dimension;
     this.TimeToLive = timeToLive;
     this.Alive = true;
 }
Esempio n. 36
0
 protected override void Awake() {
     base.Awake();
     (_collider as SphereCollider).radius = TempGameValues.StarRadius;
     circleScaleFactor = 1.0F;
     _keepoutCollider = gameObject.GetComponentsInChildren<SphereCollider>().Single(c => c.gameObject.layer == (int)Layers.CelestialObjectKeepout);
     _keepoutCollider.radius = (_collider as SphereCollider).radius * TempGameValues.KeepoutRadiusMultiplier;
     _starLight = gameObject.GetComponentInChildren<Light>();
     _billboard = gameObject.GetSafeMonoBehaviourComponentInChildren<Billboard>();
 }
Esempio n. 37
0
 protected override void Awake() {
     base.Awake();
     _audioSource = UnityUtility.ValidateComponentPresence<AudioSource>(gameObject);
     _billboard = gameObject.GetSafeMonoBehaviourComponentInChildren<Billboard>();
     _isCirclesRadiusDynamic = false;
     circleScaleFactor = 0.03F;
     minimumCameraViewingDistanceMultiplier = 0.8F;
     optimalCameraViewingDistanceMultiplier = 1.2F;
     InitializeFleetIcon();
     UpdateRate = FrameUpdateFrequency.Normal;
 }
Esempio n. 38
0
File: Tree.cs Progetto: lvarvel/aura
 public Tree(Vector3 position, float treeHeight, float angleClamp, float dropOff, int number, 
     int depth, Billboard b)
 {
     args = new DrawArgs(null, new Color4(0, .5f, 0, 1f));
     Root = new TreeBranch();
     Root.Position = position;
     var subr = new TreeBranch(treeHeight * dropOff, angleClamp, dropOff, number, new Vector3(0,1,0),
         position + new Vector3(0, treeHeight, 0), depth, b, Root, this);
     Root.Children.Add(subr);
     Position = position;
 }
Esempio n. 39
0
        //--------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="BillboardNode" /> class.
        /// </summary>
        /// <param name="billboard">The billboard.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="billboard"/> is <see langword="null"/>.
        /// </exception>
        public BillboardNode(Billboard billboard)
        {
            if (billboard == null)
            throw new ArgumentNullException("billboard");

              IsRenderable = true;
              _billboard = billboard;
              Shape = billboard.Shape;
              Color = new Vector3F(1, 1, 1);
              Alpha = 1.0f;
              _animationTime = float.NaN;
        }
Esempio n. 40
0
        public override void Enter(Dictionary<string, object> data)
        {
            var logoSprite = Storage.Sprite("SandLogo");
            var sandLogoOrigin = new Vector2(Game.BaseScreenSize.X * 0.5f - (logoSprite.Width * 0.5f), 300);

            _sandLogo = new Billboard(Game, sandLogoOrigin, logoSprite);
            _readyLabel = new Label(Game, Game.BaseScreenSize.X * 0.5f, Game.BaseScreenSize.Y * 0.5f,
                                    "Loading...", "Calibri48Bold") { PositionGravity = Gravity.Center };

            Game.Components.Add(_sandLogo);
            Game.Components.Add(_readyLabel);

            DoSignIn();
        }
Esempio n. 41
0
        public override void Enter(Dictionary<string, object> data)
        {
            _sandLogo = data["SandLogo"] as Billboard;

            var readyButtonRect = new Rectangle(0, 0, 200, 50);
            readyButtonRect.X = (int)Game.BaseScreenSize.X - readyButtonRect.Width - 50;
            readyButtonRect.Y = (int)Game.BaseScreenSize.Y - readyButtonRect.Height - 50;
            _readyButton = new Button(Game, readyButtonRect, "Ready", new Color(0.1f, 0.7f, 0.1f));
            _readyButton.SetAction((a, userInfo) => Game.TransitionState(States.Loadout), null);

            _mapChooser = new MapChooserButton(Game, new Vector2(50, 450));

            Game.Components.Add(_sandLogo);
            Game.Components.Add(_readyButton);
            Game.Components.Add(_mapChooser);
        }
Esempio n. 42
0
        public override void Enter(Dictionary<string, object> data)
        {
            Storage.IntroMusic.Play();
                Storage.InMenuMusic = true;
                Storage.AnimationController.Add(new Animation
                                                {
                                                    CompletedDelegate = () =>
                                                                        {
                                                                            if(Storage.InMenuMusic &&
                                                                               Storage.IntroMusic.State ==
                                                                               SoundState.Stopped)
                                                                            {
                                                                                Storage.LoopMusic.Play();
                                                                            }
                                                                        }
                                                }, 1, true);

            _sandLogo = data["SandLogo"] as Billboard;

            _readyLabel = new Label(Game, Game.BaseScreenSize.X * 0.5f, Game.BaseScreenSize.Y * 0.5f,
                                    "Click to Begin", "Calibri48Bold") { PositionGravity = Gravity.Center };
            _serverLabel = new Label(Game, Game.BaseScreenSize.X - 15.0f, 10.0f,
                                     "", "Calibri24Bold")
                           {
                               PositionGravity =
                                   new Tuple<Gravity.Vertical, Gravity.Horizontal>(Gravity.Vertical.Top,
                                                                                   Gravity.Horizontal.Right)
                           };
            _debugLabel = new Label(Game, 15.0f, Game.BaseScreenSize.Y - 10.0f,
                                    "", "Calibri24Bold")
                          {
                              PositionGravity =
                                  new Tuple<Gravity.Vertical, Gravity.Horizontal>(Gravity.Vertical.Bottom,
                                                                                  Gravity.Horizontal.Left),
                              Color = Color.Red
                          };

            Game.Components.Add(_sandLogo);
            Game.Components.Add(_serverLabel);
            Game.Components.Add(_debugLabel);
            Game.Components.Add(_readyLabel);
        }
 void putPlantsNumber(ref int redPlants,ref int greenPlants,ref int bluePlants,Billboard billboard,int ammountOfTotalPlants)
 {
     float toAdd = (ammountOfTotalPlants * 0.33f);
     int intPart = (int) toAdd;
     float floatPart = toAdd - intPart;
     if(Random.value<=floatPart){
         intPart++;
     }
     if(billboard.Equals(Billboard.Blue)){
         bluePlants+=(int) intPart;
     }else if(billboard.Equals(Billboard.Red)){
         redPlants+=(int) intPart;
     }else if(billboard.Equals(Billboard.Green)){
         greenPlants+=(int) intPart;
     }
 }
Esempio n. 44
0
 /**
  * adds a new Billboard to the BillboardSystem.
  * return true on success, or false if maximum
  * billboards amount have already been reached.
  */
 public bool addBillboard(Billboard bb)
 {
     if (maxIndex == billboards.Length)
     {
         return false;
     }
     else
     {
         billboards[maxIndex] = bb;
         maxIndex++;
         return true;
     }
 }
Esempio n. 45
0
        public LightGrassWibbler(Light light, Billboard billboard, ColorEx minColor, ColorEx maxColor, int minSize, int maxSize)
        {
            this.light = light;
            this.billboard = billboard;

            this.colorRange.r = (maxColor.r - minColor.r) * 0.5f;
            this.colorRange.g = (maxColor.g - minColor.g) * 0.5f;
            this.colorRange.b = (maxColor.b - minColor.b) * 0.5f;

            this.halfColor.r = (minColor.r + colorRange.r); // 2;
            this.halfColor.g = (minColor.g + colorRange.g); // 2;
            this.halfColor.b = (minColor.b + colorRange.b); // 2;

            this.minSize = minSize;
            this.sizeRange = maxSize - minSize;
        }
Esempio n. 46
0
        private static Billboard[] sortBillboards(Billboard[] billboards, Vector3 cameraLocation)
        {
            Array.Sort<Billboard>(billboards, new Comparison<Billboard>(
                (Billboard a, Billboard b) =>
                {
                    if(a == b == null) return 0;
                    else if(a == null) return 1;
                    else if(b == null) return -1;
                    else return (int)(Vector3.DistanceSquared(cameraLocation, a.getPosition()) - Vector3.DistanceSquared(cameraLocation, b.getPosition()));
                })
            );

            return billboards;
        }
Esempio n. 47
0
        public override void Enter(Dictionary<string, object> data)
        {
            _sandLogo = data["SandLogo"] as Billboard;

            var readyButtonRect = new Rectangle(0, 0, 200, 50);
            readyButtonRect.X = (int)Game.BaseScreenSize.X - readyButtonRect.Width - 50;
            readyButtonRect.Y = (int)Game.BaseScreenSize.Y - readyButtonRect.Height - 50;
            _readyButton = new Button(Game, readyButtonRect, "Ready", new Color(0.1f, 0.7f, 0.1f));
            _readyButton.SetAction((a, userInfo) => Game.TransitionState(States.ReadyWait), null);

            var weapons = new List<Type> { typeof(Cannon), typeof(EMP) };
            var utilities = new List<Type> { typeof(Shield), typeof(Ground) };
            var mobilities = new List<Type> { typeof(BoostDrive), typeof(WinkDrive), typeof(BlinkDrive) };

            var primaries = new List<Type>();

            switch((Storage.NetworkSession.LocalGamers[0].Tag as Player).Class)
            {
                case Class.None:
                    break;
                case Class.Defense:
                    primaries.Add(typeof(Jet));
                    primaries.Add(typeof(SandCharge));
                    break;
                case Class.Offense:
                    primaries.Add(typeof(Laser));
                    primaries.Add(typeof(FlameCharge));
                    break;
                case Class.Support:
                    primaries.Add(typeof(Plow));
                    primaries.Add(typeof(PressureCharge));
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            _primaryAToolChooser = new ToolChooserButton(Game, new Vector2(300, _sandLogo.Y + 220), "Primary 1",
                                                          primaries);
            _primaryBToolChooser = new ToolChooserButton(Game, new Vector2(300, _sandLogo.Y + 420), "Primary 2",
                                                          primaries);
            _primaryBToolChooser.ChooseTool(null, primaries[1], false); // TODO: this is all a hack
            _weaponsToolChooser = new ToolChooserButton(Game, new Vector2(300, _sandLogo.Y + 620), "Weapon", weapons);
            _utilitiesToolChooser = new ToolChooserButton(Game, new Vector2(300, _sandLogo.Y + 820), "Utility",
                                                          utilities);
            _mobilitiesToolChooser = new ToolChooserButton(Game, new Vector2(300, _sandLogo.Y + 1020), "Mobility",
                                                           mobilities);

            var origin = 50;
            var offset = 17;

            _primaryButtonA = new Billboard(Game, new Vector2(origin + 30, _primaryAToolChooser.Y - offset), Storage.Sprite("lmouse"))
                              { PositionGravity = Gravity.Center };

            _primaryButtonB = new Billboard(Game, new Vector2(origin + 30, _primaryBToolChooser.Y - offset), Storage.Sprite("lmouse")) { PositionGravity = Gravity.Center };

            _weaponButton = new Billboard(Game, new Vector2(origin + 30, _weaponsToolChooser.Y - offset), Storage.Sprite("rmouse")) { PositionGravity = Gravity.Center };

            _utilityButton = new Billboard(Game, new Vector2(origin, _utilitiesToolChooser.Y - offset), Storage.Sprite("shift")) { PositionGravity = Gravity.Center };

            _mobilityButton = new Billboard(Game, new Vector2(origin, _mobilitiesToolChooser.Y - offset), Storage.Sprite("space")) { PositionGravity = Gravity.Center };

            Game.Components.Add(_sandLogo);
            Game.Components.Add(_readyButton);
            Game.Components.Add(_weaponsToolChooser);
            Game.Components.Add(_utilitiesToolChooser);
            Game.Components.Add(_mobilitiesToolChooser);
            Game.Components.Add(_primaryAToolChooser);
            Game.Components.Add(_primaryBToolChooser);

            Game.Components.Add(_primaryButtonA);
            Game.Components.Add(_primaryButtonB);
            Game.Components.Add(_weaponButton);
            Game.Components.Add(_utilityButton);
            Game.Components.Add(_mobilityButton);
        }
Esempio n. 48
0
        public override void Enter(Dictionary<string, object> data)
        {
            Storage.NetworkSession.GamerJoined += GamerJoined;
            Storage.NetworkSession.GamerLeft += GamerLeft;

            var netPlayer = Storage.NetworkSession.LocalGamers[0];
            var player = netPlayer.Tag as Player;

            if(player == null)
            {
                throw new Exception("Player not inited!?");
            }

            var logoSprite = Storage.Sprite("SandLogo");
            var sandLogoOrigin = new Vector2(Game.BaseScreenSize.X * 0.5f - (logoSprite.Width * 0.5f), 30);

            _sandLogo = data.ContainsKey("SandLogo")
                            ? data["SandLogo"] as Billboard
                            : new Billboard(Game, sandLogoOrigin, logoSprite);

            Storage.AnimationController.Add(new Animation(_sandLogo, "Y", sandLogoOrigin.Y), 750);

            var readyButtonRect = new Rectangle(0, 0, 200, 50);
            readyButtonRect.X = (int)Game.BaseScreenSize.X - readyButtonRect.Width - 50;
            readyButtonRect.Y = (int)Game.BaseScreenSize.Y - readyButtonRect.Height - 50;
            _readyButton = new Button(Game, readyButtonRect, "Ready", new Color(0.1f, 0.7f, 0.1f));
            _readyButton.SetAction(ReadyButtonAction,
                null);

            var playerClassOrigin = new Vector2((Game.BaseScreenSize.X / 2.0f) - 128,
                                                sandLogoOrigin.Y + logoSprite.Height + 32);

            // TODO: this code needs to be cleaned up a lot
            // TODO: make sure we aren't clicking on a taken combination

            _redDefenseButton = new PlayerClassButton(Game, new Vector2(playerClassOrigin.X - 256, playerClassOrigin.Y),
                                                      Class.Defense, Team.Red);
            _redDefenseButton.Button.SetAction((a, userInfo) =>
                                               {
                                                   player.Team = Team.Red;
                                                   player.Class = Class.Defense;
                                                   Sound.OneShot(AddRandomSuffix("DefenseClass"), false);
                                               }, null);
            Game.Components.Add(_redDefenseButton);
            _redOffenseButton = new PlayerClassButton(Game,
                                                      new Vector2(playerClassOrigin.X - 256,
                                                                  playerClassOrigin.Y + 256 + 64), Class.Offense,
                                                      Team.Red);
            _redOffenseButton.Button.SetAction((a, userInfo) =>
                                               {
                                                   player.Team = Team.Red;
                                                   player.Class = Class.Offense;
                                                   Sound.OneShot(AddRandomSuffix("OffenseClass"), false);
                                               }, null);
            Game.Components.Add(_redOffenseButton);
            _redSupportButton = new PlayerClassButton(Game,
                                                      new Vector2(playerClassOrigin.X - 256,
                                                                  playerClassOrigin.Y + 512 + 128), Class.Support,
                                                      Team.Red);
            _redSupportButton.Button.SetAction((a, userInfo) =>
                                               {
                                                   player.Team = Team.Red;
                                                   player.Class = Class.Support;
                                                   Sound.OneShot(AddRandomSuffix("SupportClass"), false);
                                               }, null);
            Game.Components.Add(_redSupportButton);

            _blueDefenseButton = new PlayerClassButton(Game, new Vector2(playerClassOrigin.X + 256, playerClassOrigin.Y),
                                                       Class.Defense, Team.Blue);
            _blueDefenseButton.Button.SetAction((a, userInfo) =>
                                                {
                                                    player.Team = Team.Blue;
                                                    player.Class = Class.Defense;
                                                    Sound.OneShot(AddRandomSuffix("DefenseClass"), false);
                                                }, null);
            Game.Components.Add(_blueDefenseButton);
            _blueOffenseButton = new PlayerClassButton(Game,
                                                       new Vector2(playerClassOrigin.X + 256,
                                                                   playerClassOrigin.Y + 256 + 64), Class.Offense,
                                                       Team.Blue);
            _blueOffenseButton.Button.SetAction((a, userInfo) =>
                                                {
                                                    player.Team = Team.Blue;
                                                    player.Class = Class.Offense;
                                                    Sound.OneShot(AddRandomSuffix("OffenseClass"), false);
                                                }, null);
            Game.Components.Add(_blueOffenseButton);
            _blueSupportButton = new PlayerClassButton(Game,
                                                       new Vector2(playerClassOrigin.X + 256,
                                                                   playerClassOrigin.Y + 512 + 128), Class.Support,
                                                       Team.Blue);
            _blueSupportButton.Button.SetAction((a, userInfo) =>
                                                {
                                                    player.Team = Team.Blue;
                                                    player.Class = Class.Support;
                                                    Sound.OneShot(AddRandomSuffix("SupportClass"), false);
                                                }, null);
            Game.Components.Add(_blueSupportButton);

            _classDescriptions = new ClassDescription[3];

            _classDescriptions[0] = new ClassDescription(Game, Class.Defense)
                                    {
                                        X =
                                            (_blueSupportButton.Button.X + _redSupportButton.Button.X +
                                             _redSupportButton.Button.Width) / 2,
                                        Y = _redDefenseButton.Button.Y
                                    };

            _classDescriptions[1] = new ClassDescription(Game, Class.Offense)
                                    {
                                        X = _classDescriptions[0].X,
                                        Y = _redOffenseButton.Button.Y
                                    };

            _classDescriptions[2] = new ClassDescription(Game, Class.Support)
                                    {
                                        X = _classDescriptions[0].X,
                                        Y = _redSupportButton.Button.Y
                                    };

            _tutorialButton = new Button(Game, new Rectangle(50, readyButtonRect.Y, 200, 50), "Tutorial");
            _tutorialButton.SetAction((a, b) => DoTutorial(), null);

            Game.Components.Add(_sandLogo);
            Game.Components.Add(_readyButton);
            Game.Components.Add(_classDescriptions[0]);
            Game.Components.Add(_classDescriptions[1]);
            Game.Components.Add(_classDescriptions[2]);

            if(Storage.NetworkSession.IsHost)
            {
                Game.Components.Add(_tutorialButton);
            }
        }
Esempio n. 49
0
File: Tree.cs Progetto: lvarvel/aura
 internal TreeLeaf(Vector3 position, Billboard b, TreeBranch parent, Tree root)
 {
     Position = position;
     leaf = b;
     Parent = parent;
     Root = root;
 }
Esempio n. 50
0
 protected override void Awake() {
     base.Awake();
     _billboard = gameObject.GetSingleComponentInChildren<Billboard>();
 }