Ejemplo n.º 1
0
 public Tunnel(Texture2D texture, int ID, TunnelObject tunnelObject)
 {
     this.texture      = texture;
     this.ID           = ID;
     this.tunnelObject = tunnelObject;
     cardType          = CardType.Tunnel;
     entrance          = new bool[4];
     graph             = new bool[4, 4];
 }
Ejemplo n.º 2
0
        public void GenerateElements(ElementManager manager, Tunnel.TunnelSectionCreatedEventArgs e)
        {
            _intermediatePositions.Clear();
            //
            // Generating the stars
            //
            for (int i = 0; i < 10; i++)
            {
                int pos = _rand.Next(0, e.tunnelSection.NumSegments * e.tunnelSection.TunnelLengthInCells);
                if (_intermediatePositions.Contains(pos) || _rand.NextDouble() > _starsFreq)
                {
                    continue;
                }
                _intermediatePositions.Add(pos);

                Matrix transform = manager.GetNewElementTranform(
                    pos % e.tunnelSection.NumSegments,
                    pos / e.tunnelSection.NumSegments, e);

                TunnelObject obj = manager.StarFactory.GetElement(manager.Scene);
                obj.CircularSegment = pos % e.tunnelSection.NumSegments;
                obj.InitializeTransform(transform, Tunnel.GetTunnelOffset(e.tunnelSection.PhaseAtStart - transform.Translation.Z));
            }

            //
            // Generatig the bombs
            //
            for (int i = 0; i < 10; i++)
            {
                int pos = _rand.Next(0, e.tunnelSection.NumSegments * e.tunnelSection.TunnelLengthInCells);
                if (_intermediatePositions.Contains(pos) || _rand.NextDouble() > _bombFreq)
                {
                    continue;
                }
                _intermediatePositions.Add(pos);

                Matrix transform = manager.GetNewElementTranform(
                    pos % e.tunnelSection.NumSegments,
                    pos / e.tunnelSection.NumSegments, e);

                TunnelObject obj = manager.BombFactory.GetElement(manager.Scene);
                obj.CircularSegment = pos % e.tunnelSection.NumSegments;
                obj.InitializeTransform(transform, Tunnel.GetTunnelOffset(e.tunnelSection.PhaseAtStart - transform.Translation.Z));
            }
        }
Ejemplo n.º 3
0
        public static Card ParseString(string line, int ID) //linijka z pliku oraz numer linijki (czyli numer karty)
        {
            string[] words = line.Split(' ');
            int      size  = words.Length;

            if (words[0] == "T")
            {
                TunnelObject objekt = (TunnelObject)int.Parse(words[size - 1]);
                Tunnel       output = new Tunnel(Logic.cardTexture[ID], ID, objekt);
                for (int i = 0; i < 4; i++)
                {
                    output.entrance[i] = Convert.ToBoolean(int.Parse(words[i + 1]));
                }
                for (int i = 0; i < 16; i++)
                {
                    output.graph[i / 4, i % 4] = Convert.ToBoolean(int.Parse(words[i + 5]));
                }
                return(output);
            }
            else if (words[0] == "B")
            {
                BuffCard output = new BuffCard(Logic.cardTexture[ID], ID, (Buff)int.Parse(words[1]));
                return(output);
            }
            else if (words[0] == "D")
            {
                DebuffCard output = new DebuffCard(Logic.cardTexture[ID], ID, (Buff)int.Parse(words[1]), (Buff)int.Parse(words[2]));
                return(output);
            }
            else if (words[0] == "M")
            {
                MapCard output = new MapCard(Logic.cardTexture[ID], ID);
                return(output);
            }
            else if (words[0] == "C")
            {
                RemoveCard output = new RemoveCard(Logic.cardTexture[ID], ID);
                return(output);
            }
            return(null);
        }