Ejemplo n.º 1
0
    public void LoadOverlays()
    {
        for (int i = 0; i < MasterScript.systemListConstructor.systemList.Count; ++i)
        {
            OverlayObject tempObj = new OverlayObject();

            tempObj.container    = NGUITools.AddChild(overlayContainer, overlayObject);
            tempObj.power        = tempObj.container.transform.Find("Power").GetComponent <UILabel>();
            tempObj.knowledge    = tempObj.container.transform.Find("Knowledge").GetComponent <UILabel>();
            tempObj.name         = tempObj.container.transform.Find("Name").GetComponent <UILabel>();
            tempObj.planets      = tempObj.container.transform.Find("Planets Colonised").GetComponent <UISprite>();
            tempObj.overlayOuter = tempObj.container.transform.Find("Overlay Outer").transform;

            tempObj.name.text          = MasterScript.systemListConstructor.systemList[i].systemName.ToUpper();
            tempObj.planets.spriteName = systemSize[MasterScript.systemListConstructor.systemList[i].systemSize - 1];
            tempObj.rotSpeed           = UnityEngine.Random.Range(2f, 6f);

            int rnd = UnityEngine.Random.Range(0, 2);

            if (rnd == 0)
            {
                tempObj.rotDir = Vector3.forward;
            }
            if (rnd == 1)
            {
                tempObj.rotDir = Vector3.back;
            }

            TweenAlpha.Begin(tempObj.container, 0f, 0f);

            overlayObjectList.Add(tempObj);
        }
    }
Ejemplo n.º 2
0
    void Start()
    {
        _renderer = GetComponent <MeshRenderer>();

        if (!_renderer)
        {
            _renderer = GetComponent <SkinnedMeshRenderer>();
        }

        if (!_renderer)
        {
            Debug.LogErrorFormat("Could not find 'Renderer' component on {0}", gameObject.name);

            // destroy it
            Destroy(this);
            return;
        }

        _overlayObject = GetComponentInParent <OverlayObject>();

        if (_overlayObject)
        {
            _overlayObject.Meshes.Add(this);
        }
        else
        {
            // destroy it
            Destroy(this);
        }
    }
Ejemplo n.º 3
0
 internal static string GetTibName(OverlayObject o, EngineType engine)
 {
     if (engine <= EngineType.Firestorm)
     {
         if (IsTS_Riparius(o))
         {
             return("Riparius");
         }
         else if (IsTS_Cruentus(o))
         {
             return("Cruentus");
         }
         else if (IsTS_Vinifera(o))
         {
             return("Vinifera");
         }
         else if (IsTS_Aboreus(o))
         {
             return("Aboreus");
         }
     }
     else
     {
         if (IsRA2_Riparius(o))
         {
             return("Riparius");
         }
         else if (IsRA2_Cruentus(o))
         {
             return("Cruentus");
         }
         else if (IsRA2_Vinifera(o))
         {
             return("Vinifera");
         }
         else if (IsRA2_Aboreus(o))
         {
             return("Aboreus");
         }
     }
     return("");
 }
Ejemplo n.º 4
0
 public static OverlayTibType GetOverlayTibType(OverlayObject o, EngineType engine)
 {
     if (engine <= EngineType.Firestorm)
     {
         if (IsTS_Riparius(o))
         {
             return(OverlayTibType.Riparius);
         }
         else if (IsTS_Cruentus(o))
         {
             return(OverlayTibType.Cruentus);
         }
         else if (IsTS_Vinifera(o))
         {
             return(OverlayTibType.Vinifera);
         }
         else if (IsTS_Aboreus(o))
         {
             return(OverlayTibType.Aboreus);
         }
     }
     else
     {
         if (IsRA2_Riparius(o))
         {
             return(OverlayTibType.Riparius);
         }
         else if (IsRA2_Cruentus(o))
         {
             return(OverlayTibType.Cruentus);
         }
         else if (IsRA2_Vinifera(o))
         {
             return(OverlayTibType.Vinifera);
         }
         else if (IsRA2_Aboreus(o))
         {
             return(OverlayTibType.Aboreus);
         }
     }
     return(OverlayTibType.NotSpecial);
 }
Ejemplo n.º 5
0
        private void LoadOverlayDrawable(Drawable drawable)
        {
            int            objIdx  = _drawables.Count - 1;
            var            ovl     = new OverlayObject((byte)objIdx, 0);
            var            tibType = SpecialOverlays.GetOverlayTibType(ovl, Engine);
            DrawProperties props   = drawable.Props;

            if (Engine >= EngineType.RedAlert2)
            {
                if (tibType != OverlayTibType.NotSpecial)
                {
                    props.FrameDecider = FrameDeciders.OverlayValueFrameDecider;
                    props.PaletteType  = PaletteType.Overlay;
                    props.LightingType = LightingType.None;
                }
                else if (SpecialOverlays.IsHighBridge(ovl))
                {
                    props.OffsetHack       = OffsetHacks.RA2BridgeOffsets;
                    props.ShadowOffsetHack = OffsetHacks.RA2BridgeShadowOffsets;
                    drawable.TileElevation = 4;                     // for lighting
                    drawable.Foundation    = new Size(3, 1);        // ensures they're drawn later --> fixes overlap
                }
            }
            else if (Engine <= EngineType.Firestorm)
            {
                if (tibType != OverlayTibType.NotSpecial)
                {
                    props.FrameDecider   = FrameDeciders.OverlayValueFrameDecider;
                    props.PaletteType    = PaletteType.Unit;
                    props.LightingType   = LightingType.None;
                    drawable.IsRemapable = true;
                }
                else if (SpecialOverlays.IsHighBridge(ovl) || SpecialOverlays.IsTSHighRailsBridge(ovl))
                {
                    props.OffsetHack       = OffsetHacks.TSBridgeOffsets;
                    props.ShadowOffsetHack = OffsetHacks.TSBridgeShadowOffsets;
                    drawable.TileElevation = 4;                     // for lighting
                    //drawable.Foundation = new Size(3, 1); // ensures they're drawn later --> fixes overlap
                }
            }
        }
Ejemplo n.º 6
0
 public static bool IsTSHighRailsBridge(OverlayObject o)
 {
     return(o.OverlayID == 59 || o.OverlayID == 60);
 }
Ejemplo n.º 7
0
 public static bool IsHighBridge(OverlayObject o)
 {
     return(o.OverlayID == 24 || o.OverlayID == 25 || o.OverlayID == 238 || o.OverlayID == 237);
 }
Ejemplo n.º 8
0
 private static bool IsTib(OverlayObject o)
 {
     return(IsTS_Riparius(o) || IsTS_Cruentus(o) || IsTS_Vinifera(o) || IsTS_Aboreus(o));
 }
Ejemplo n.º 9
0
 private static bool IsTS_Aboreus(OverlayObject o)
 {
     return(o.OverlayID >= TsMinIdAboreus && o.OverlayID <= TsMaxIdAboreus);
 }
Ejemplo n.º 10
0
 private static bool IsTS_Vinifera(OverlayObject o)
 {
     return(o.OverlayID >= TsMinIdVinifera && o.OverlayID <= TsMaxIdVinifera);
 }
Ejemplo n.º 11
0
 private static bool IsTS_Cruentus(OverlayObject o)
 {
     return(o.OverlayID >= TsMinIdCruentus && o.OverlayID <= TsMaxIdCruentus);
 }
Ejemplo n.º 12
0
 private static bool IsRA2_Aboreus(OverlayObject o)
 {
     return(o.OverlayID >= Ra2MinIdAboreus && o.OverlayID <= Ra2MaxIdAboreus);
 }
Ejemplo n.º 13
0
 private static bool IsRA2_Vinifera(OverlayObject o)
 {
     return(o.OverlayID >= Ra2MinIdVinifera && o.OverlayID <= Ra2MaxIdVinifera);
 }
Ejemplo n.º 14
0
 private static bool IsRA2_Cruentus(OverlayObject o)
 {
     return(o.OverlayID >= Ra2MinIdCruentus && o.OverlayID <= Ra2MaxIdCruentus);
 }
Ejemplo n.º 15
0
 private static bool IsRA2_Riparius(OverlayObject o)
 {
     return(o.OverlayID >= Ra2MinIdRiparius && o.OverlayID <= Ra2MaxIdRiparius);
 }
Ejemplo n.º 16
0
        /// <summary>Reads all objects. </summary>
        private void LoadAllObjects(MapFile mf)
        {
            // import tiles
            foreach (var iso in mf.Tiles)
            {
                _tiles[iso.Dx, iso.Dy / 2] = new MapTile(iso.Dx, iso.Dy, iso.Rx, iso.Ry, iso.Z, iso.TileNum, iso.SubTile, _tiles);
            }

            // import terrain
            foreach (var terr in mf.Terrains)
            {
                var t = new TerrainObject(terr.Name);
                _terrainObjects.Add(t);
                _tiles.GetTile(terr.Tile).AddObject(t);
            }

            // import smudges
            foreach (var sm in mf.Smudges)
            {
                var s = new SmudgeObject(sm.Name);
                _tiles.GetTile(sm.Tile).AddObject(s);
                _smudgeObjects.Add(s);
            }

            // import overlays
            foreach (var o in mf.Overlays)
            {
                var ovl = new OverlayObject(o.OverlayID, o.OverlayValue);
                _tiles.GetTile(o.Tile).AddObject(ovl);
                _overlayObjects.Add(ovl);
            }

            // import infantry
            foreach (var i in mf.Infantries)
            {
                var inf = new InfantryObject(i.Owner, i.Name, i.Health, i.Direction, i.OnBridge);
                _tiles.GetTile(i.Tile).AddObject(inf);
                _infantryObjects.Add(inf);
            }

            foreach (var u in mf.Units)
            {
                var un = new UnitObject(u.Owner, u.Name, u.Health, u.Direction, u.OnBridge);
                _tiles.GetTile(u.Tile).AddObject(un);
                _unitObjects.Add(un);
            }

            foreach (var a in mf.Aircrafts)
            {
                var ac = new AircraftObject(a.Owner, a.Name, a.Health, a.Direction, a.OnBridge);
                _tiles.GetTile(a.Tile).AddObject(ac);
                _aircraftObjects.Add(ac);
            }

            foreach (var s in mf.Structures)
            {
                var str = new StructureObject(s.Owner, s.Name, s.Health, s.Direction);
                str.Upgrade1 = s.Upgrade1;
                str.Upgrade2 = s.Upgrade2;
                str.Upgrade3 = s.Upgrade3;
                _tiles.GetTile(s.Tile).AddObject(str);
                _structureObjects.Add(str);
            }
        }
Ejemplo n.º 17
0
 private static bool IsTS_Riparius(OverlayObject o)
 {
     return(o.OverlayID >= TsMinIdRiparius && o.OverlayID <= TsMaxIdRiparius);
 }