Ejemplo n.º 1
0
 public void Add(int head, int tail)
 {
     Heads.Add(head);
     Tails.Add(tail);
     HeadsTails.Add(new KeyValuePair <int, int>(head, tail));
     CreateArcList();
 }
        public void Compile()
        {
            Assembly assembly = Assembly.LoadFrom(Configuration.InputPath);

            var markerAttribute = GetAssemblyAttribute(assembly);

            foreach (var type in markerAttribute.Types ?? Enumerable.Empty <Type>())
            {
                var head = new CSharpNode(type.Name, TypeConversion.FromCSharpReflection(type));
                if (head.CSNodeType.Equals(CSharpNodeType.None))
                {
                    continue;
                }
                head.Visibility = Visibility.Public;

                Heads.Add(head);

                foreach (var property in type.GetProperties())
                {
                    InsertPropertyNodeInTree(property);
                }

                Trees.Add(Generator.GetSyntaxTree(head));
            }

            Trees.ForEach(tree => Generator.LinkingResolver.Resolve(tree));
        }
Ejemplo n.º 3
0
        }                                 // Place holder delegate

        public PullDownMenus(Heads id)
        {
            Top[id] = this;
            switch (id)
            {
            case Heads.File:
                new PullDownMenus(id, "Open Project Folder", Project.OpenProject, Keys.P);
                new PullDownMenus(id, "New File", NOTHING, Keys.N, delegate { return(Project.ChosenProject != null); });
                new PullDownMenus(id, "Save", delegate {
                    //Debug.WriteLine($"[SAVE]{Project.ChosenProject.CurrentDoc}[/SAVE]");
                    Project.ChosenProject.CurrentDoc.Save(Project.ChosenProject.CurrentItem.filename);
                }, Keys.S, NeedDoc);
                new PullDownMenus(id, "Save As", NOTHING);
                new PullDownMenus(id, "Save All", NOTHING);
                new PullDownMenus(id, "Quit", NOTHING);
                break;

            case Heads.Edit:
                new PullDownMenus(id, "Cut", NOTHING, Keys.X);
                new PullDownMenus(id, "Copy", NOTHING, Keys.C);
                new PullDownMenus(id, "Paste", NOTHING, Keys.V);
                break;

            case Heads.Search:
                new PullDownMenus(id, "Search", NOTHING, Keys.F);
                new PullDownMenus(id, "Replace", NOTHING, Keys.H);
                break;

            case Heads.Build:
                new PullDownMenus(id, "Build", NOTHING, Keys.B);
                new PullDownMenus(id, "Build + Run", NOTHING, Keys.R);
                break;
            }
        }
Ejemplo n.º 4
0
        private void DrawContent(SpriteBatch spriteBatch)
        {
            int currentX = 0;

            for (int columnIndex = 0; columnIndex < _columnHeaders.Count; columnIndex++)
            {
                ColumnHeader column = _columnHeaders[columnIndex];
                DrawCellContent(spriteBatch, column.Caption, new Vector2(currentX, 0), HeaderColor);

                for (int i = 0; i < _rows.Count; i++)
                {
                    Cell    cell     = _rows[i].Cells[columnIndex];
                    int     indent   = cell.HeadId > 0 ? RowHeight + 2 : 0;
                    Vector2 position = new Vector2(currentX, (i + 1) * RowHeight);

                    DrawCellContent(spriteBatch,
                                    cell.Text,
                                    position + new Vector2(indent, 0),
                                    _rows[i].Color.GetValueOrDefault(ContentColor));

                    if (cell.HeadId <= 0)
                    {
                        continue;
                    }
                    var p = (Start + position + new Vector2(1)).ToPoint();
                    Heads.Draw(spriteBatch, cell.HeadId, p.X, p.Y, RowHeight - 2, RowHeight - 2);
                }
                currentX += column.Width;
            }
        }
	public static bool checkShape(Heads h){
		Position p1 = findCenter (findCenter (h.c.north, h.c.south), findCenter (h.c.west, h.c.east));
		Position p2 = findCenterPlus (findCenterPlus (h.c.north, h.c.south), findCenterPlus (h.c.west, h.c.east));

		if (inList (p1, h.elems) || inList (p2, h.elems))	return true;
		else return false;
	
	}
    // Use this for initialization
    void Start()
    {
        heads    = this.GetComponent <Heads>();
        animator = this.GetComponent <Animator>();

        walkingSound.loop = true;
        idleSound.loop    = true;
    }
	public static void setFlag(Heads h,GameObject object1,GameObject object2,GameObject object3){
		
		if (checkMoisAndTemp (h))
				if (h.elems.Count <= villageSize)
						h.roadPoints = createVillage (h,object1);
				else if (h.elems.Count <= townSize)
						h.roadPoints = createTown (h,object1, object2, object3);
				else h.roadPoints = createMetro (h,object2, object3);
	}
Ejemplo n.º 8
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Cylinder.GetHashCode();
         result = (result * 397) ^ Heads.GetHashCode();
         result = (result * 397) ^ Sectors.GetHashCode();
         return(result);
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Updates all references of <see cref="ReferenceType.LocalBranch"/> or
        /// <see cref="ReferenceType.RemoteBranch"/> type.
        /// </summary>
        public void RefreshBranches()
        {
            var refs = Repository.Accessor.QueryReferences.Invoke(
                new QueryReferencesParameters(
                    ReferenceType.LocalBranch |
                    ReferenceType.RemoteBranch));

            Heads.Refresh(refs.Heads);
            Remotes.Refresh(refs.Remotes);
        }
Ejemplo n.º 10
0
 public void Dispose()
 {
     if (Heads != null && Heads.Any())
     {
         Heads.Clear();
     }
     if (_data != null && _data.Any())
     {
         _data.Clear();
     }
 }
Ejemplo n.º 11
0
        public async void FlushAsync()
        {
            await _stream.WriteHeadersAsync(Heads, false);

            Heads.Clear();
            if (_data.Any())
            {
                await _stream.WriteAsync(new ArraySegment <byte>(_data.ToArray()), false);
            }
            _data.Clear();
        }
Ejemplo n.º 12
0
 public override void Configure()
 {
     base.Configure();
     // The CoreNLP constituency parse can have a noun phrase that contains another noun phrase as its head.
     // For SimpleNLG realization we need to flatten this configuration into a single noun phrase.
     if (Heads.Count() == 1 && Heads.Single() is NounPhraseBuilder loneHeadPhrase)
     {
         RemoveChild(loneHeadPhrase);
         Assimilate(loneHeadPhrase);
     }
 }
	public static void createTown(Heads h,GameObject object2){
		//Elem el = h.elems [0];
		foreach (Elem el in h.elems) {
			GameObject c = (GameObject)Instantiate (object2, new Vector3 ((el.p.y-1)* Field.tile*8,Field.mat [el.p.x, el.p.y].height*512,(el.p.x-1)* Field.tile*8), Quaternion.identity);
		c.transform.localScale = c.transform.localScale + new Vector3 (Field.tile, Field.tile, Field.tile);
		//c.transform.localScale=new Vector3(10,10,10);	
		//c.transform.localScale = new Vector3 (0.5f, 0.5f, 0.5f);
			}
		
		Debug.Log("Town");
		
	}
        private void InsertPropertyNodeInTree(PropertyInfo propertyInfo)
        {
            var node = new CSharpNode(propertyInfo.Name, CSharpNodeType.Property);

            node.Type = new TypeWrapper()
            {
                Kind           = TypeConversion.KindFromReflectionType(propertyInfo.PropertyType),
                RawKind        = TypeConversion.RawKindFromReflectionType(propertyInfo.PropertyType),
                UnderlyingKind = TypeConversion.UnderlyingKindFromReflectionType(propertyInfo.PropertyType)
            };
            Heads.Last().Children.Add(node);
        }
Ejemplo n.º 15
0
        public DataContext()
        {
            foreach (var chara in Info.Instance().Member)
            {
                if (chara.Value == 0)
                {
                    continue;
                }
                Charactors.Add(new Charactor((chara.Value - 1) * 0x4010 + 0xA8750)
                {
                    Name = chara.Name
                });
            }

            foreach (var info in Info.Instance().Tools)
            {
                Tools.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Mains)
            {
                Mains.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Subs)
            {
                Subs.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Heads)
            {
                Heads.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Bodys)
            {
                Bodys.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Accessorys)
            {
                Accessorys.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Materials)
            {
                Materials.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Synthesises)
            {
                Synthesises.Add(new Item(info, 0xA3D68));
            }

            for (uint i = 0; i < 9; i++)
            {
                Party.Add(new SaveDataValue <uint>(0xA3D38 + 4 * i, 4, 0, 9));
            }
        }
	public static void createVillage(Heads h,GameObject object1){
		int numRows=3;
		if (Mathf.Abs (h.c.west.x - h.c.east.x) < numRows * Field.tile)
						numRows = 2;
		//Elem el = h.elems [0];
		foreach (Elem el in h.elems) {
			GameObject c = (GameObject)Instantiate (object1, new Vector3 ((el.p.y-1)* Field.tile*8,Field.mat [el.p.x, el.p.y].height*512,(el.p.x-1)* Field.tile*8), Quaternion.identity);
			c.transform.localScale = c.transform.localScale + new Vector3 (Field.tile, Field.tile, Field.tile);
//			c.transform.localScale=new Vector3(10,10,10);	
			//c.transform.localScale = new Vector3 (0.5f, 0.5f, 0.5f);
		}
		Debug.Log("Selo");
	}
Ejemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     npcList            = new List <GameObject>();
     responsibilityNpcs = new List <GameObject>();
     spawnPoint         = new Vector3(-790, 0, -22); //(-501, 0, 951);
     spawnTime          = 5;
     usedIds            = new List <string>();
     invObj             = GameObject.Find("Inventory");
     database           = invObj.GetComponent <ItemDatabase>();
     clock    = GameObject.FindGameObjectWithTag("Clock").GetComponent <ClockTime>();
     tutorial = GameObject.Find("Tutorial").GetComponent <Tutorial>();
     heads    = GameObject.Find("Heads").GetComponent <Heads>();
 }
Ejemplo n.º 18
0
        public override void OnDraw(float elapsedTime)
        {
            base.OnDraw(elapsedTime);

            _titledBorder.Draw(Game.SpriteBatch, true);

            int rowHeight = Resources.NormalFont.LineSpacing + Padding;
            int startY    = _titledBorder.ClientRectangle.Y;

            switch (_gameExecution.CurrentMatchResultType)
            {
            case MatchResultType.SomeOneWins:
                DrawWinner(startY, Game.SpriteBatch);
                break;

            case MatchResultType.Draw:
                DrawDraw(startY, Game.SpriteBatch);
                break;
            }

            startY += rowHeight;

            Game.ShapeRenderer.DrawLine(_titledBorder.ClientRectangle.X, startY, _titledBorder.ClientRectangle.Right, startY, Color.White);

            startY += PaddingToHeading;

            foreach (var member in _gameExecution.CurrentLevel.Figures)
            {
                Heads.Draw(Game.SpriteBatch, member.Id, _titledBorder.ClientRectangle.X, startY, rowHeight - 2,
                           rowHeight - 2);

                Game.SpriteBatch.DrawString(
                    Resources.NormalFont,
                    member.Name,
                    new Vector2(_titledBorder.ClientRectangle.X + rowHeight, startY),
                    member.IsMatchWinner ? Color.Orange : Color.White);

                Game.SpriteBatch.DrawString(
                    Resources.NormalFont,
                    member.Wins.ToString(CultureInfo.InvariantCulture),
                    new Vector2(_titledBorder.ClientRectangle.X + PlayerWidth, startY),
                    member.IsMatchWinner ? Color.Orange : Color.White);

                startY += rowHeight;
            }

            startY = _titledBorder.ClientRectangle.Y + (Resources.NormalFont.LineSpacing + Padding) * 5 + PaddingToHeading;
            Game.ShapeRenderer.DrawLine(_titledBorder.ClientRectangle.X, startY, _titledBorder.ClientRectangle.Right, startY, Color.White);

            Game.SpriteBatch.DrawString(Resources.NormalFont, "Press Enter to resume", new Vector2(_titledBorder.ClientRectangle.X, startY), Color.White);
        }
Ejemplo n.º 19
0
        private void CreateArcList()
        {
            var count = Heads.Concat(Tails).Max() + 1;

            HeadsList  = Enumerable.Repeat(-1, count).ToList();
            Colors     = Enumerable.Repeat(-1, count).ToList();
            References = new List <int>(Heads.Count);
            for (int k = 0; k < Heads.Count; k++)
            {
                var i = Heads[k];
                References.Add(HeadsList[i]);
                HeadsList[i] = k;
            }
        }
Ejemplo n.º 20
0
 public void LoadAll()
 {
     Floors.LoadAll();
     Items.LoadAll();
     Creatures.LoadAll();
     Templates.LoadAll();
     Animations.LoadAll();
     Heads.LoadAll();
     Chests.LoadAll();
     Legs.LoadAll();
     Arms.LoadAll();
     Weapons.LoadAll();
     Shields.LoadAll();
 }
Ejemplo n.º 21
0
        public void SetHeader(HeaderField headerField)
        {
            if (string.IsNullOrEmpty(headerField.Name))
            {
                return;
            }

            var hf = Heads.Where(b => b.Name == headerField.Name).FirstOrDefault();

            if (!string.IsNullOrEmpty(hf.Name))
            {
                Heads.Remove(hf);
            }
            Heads.Add(headerField);
        }
Ejemplo n.º 22
0
        public bool MatchesSearchString(string searchString)
        {
            if (Heads.Any(gitHead => gitHead.Name.ToLower().Contains(searchString)))
            {
                return(true);
            }

            if ((searchString.Length > 2) && Guid.StartsWith(searchString, StringComparison.CurrentCultureIgnoreCase))
            {
                return(true);
            }

            return
                (Author.StartsWith(searchString, StringComparison.CurrentCultureIgnoreCase) ||
                 Message.ToLower().Contains(searchString));
        }
Ejemplo n.º 23
0
        private void DrawWinner(int startY, SpriteBatch spriteBatch)
        {
            int    rowHeight     = Resources.NormalFont.LineSpacing + Padding;
            Figure memberWhoWins = _gameExecution.CurrentLevel.Figures.First(c => c.IsMatchWinner);
            int    currentX      = _titledBorder.ClientRectangle.X;

            const string text = " Winner:";

            spriteBatch.DrawString(Resources.NormalFont, text, new Vector2(currentX, startY), Color.White);

            currentX += (int)Math.Ceiling(Resources.NormalFont.MeasureString(text).X) + Padding;
            Heads.Draw(spriteBatch, memberWhoWins.Id, currentX, startY, rowHeight - 2, rowHeight - 2);

            currentX += rowHeight;
            spriteBatch.DrawString(Resources.NormalFont, memberWhoWins.Name, new Vector2(currentX, startY), Color.White);
        }
Ejemplo n.º 24
0
        /// <summary>Loads the specified references.</summary>
        /// <param name="refs">References data.</param>
        internal void Load(ReferencesData refs)
        {
            Verify.Argument.IsNotNull(refs, nameof(refs));

            if (refs.Heads != null)
            {
                Heads.Load(refs.Heads);
            }
            if (refs.Remotes != null)
            {
                Remotes.Load(refs.Remotes);
            }
            if (refs.Tags != null)
            {
                Tags.Load(refs.Tags);
            }
        }
Ejemplo n.º 25
0
        protected override void LoadContent()
        {
            base.LoadContent();
            Heads.LoadContent(Content);
            Resources.LoadContent(Content);
            Resources.ChangeResolution(ScreenWidth, ScreenHeight);
            Cursor.AddCursorType("Arrow", new CursorType(Content.Load <Texture2D>("textures/cursor")));

            var parameters = new GuiSystemSkinParameters
            {
                XmlSkinDescriptorFile = "Content/GuiLayouts/Skin/GuiSkin.xml",
                BigFont     = Resources.BigFont,
                NormalFont  = Resources.NormalFont,
                SkinTexture = Content.Load <Texture2D>("textures/bombrush_guiskin")
            };

            GuiSystem.SetSkin(parameters);
        }
Ejemplo n.º 26
0
        /// <summary>Updates cached references of specified types.</summary>
        /// <param name="referenceTypes">Reference types to update.</param>
        public void Refresh(ReferenceType referenceTypes)
        {
            var refs = Repository.Accessor.QueryReferences.Invoke(
                new QueryReferencesParameters(referenceTypes));

            if ((referenceTypes & ReferenceType.LocalBranch) == ReferenceType.LocalBranch)
            {
                Heads.Refresh(refs.Heads);
            }
            if ((referenceTypes & ReferenceType.RemoteBranch) == ReferenceType.RemoteBranch)
            {
                Remotes.Refresh(refs.Remotes);
            }
            if ((referenceTypes & ReferenceType.Tag) == ReferenceType.Tag)
            {
                Tags.Refresh(refs.Tags);
            }
        }
Ejemplo n.º 27
0
 public PullDownMenus(Heads parent, string Caption, CallBackVoid CB, Keys QuickKey = Keys.None, RequireBool Requirement = null)
 {
     ParentTop = parent;
     Parent    = Top[parent];
     Parent.Kids.Add(this);
     this.Caption  = Caption;
     CaptGraph     = Void.Font.Text(Caption);
     CallBack      = CB;
     this.QuickKey = QuickKey;
     if (Requirement != null)
     {
         Require = Requirement;
     }
     else
     {
         Require = Always;
     }
     Debug.WriteLine($"Created menu item {Caption} in parent {parent}");
 }
Ejemplo n.º 28
0
    // Use this for initialization
    void Start()
    {
        modeltransform = transform.FindChild("3D").FindChild("Model");
        head           = modeltransform.FindChild("iiro_head").gameObject;

        savedData = GameObject.Find("SavedData").GetComponent <SavedData>();
        heads     = GameObject.Find("Heads").GetComponent <Heads>();

        currentProfile = savedData.getProfile();

        head.GetComponent <MeshFilter>().sharedMesh       = heads.getPlayersHead().GetComponent <MeshFilter>().sharedMesh;
        head.GetComponent <MeshRenderer>().sharedMaterial = heads.getPlayersHead().GetComponent <MeshRenderer>().sharedMaterial;
        transform.FindChild("NameInputField").FindChild("Text").GetComponent <Text>().text = currentProfile.name;
        gender = currentProfile.gender;

        transform.FindChild("NameInputField").GetComponent <InputField>().text = currentProfile.name;

        warning = transform.FindChild("Warning").gameObject;
        warning.SetActive(false);
    }
Ejemplo n.º 29
0
            public void DoSummon()
            {
                if (Deleted || Map == null || Map == Map.Internal)
                {
                    Heads.SetAll(false);
                    return;
                }

                var mp = new MapPoint(Map, GetWorldLocation());

                new TornadoEffect(mp, mp, Direction.North, 3)
                {
                    CanMove = false
                }.Send();

                Visible = false;

                new MovingEffectInfo(mp, mp.Clone3D(0, 0, 80), mp, ItemID, Hue, 5).MovingImpact(
                    () => Timer.DelayCall(TimeSpan.FromSeconds(1.5), EndSummon, mp));
            }
Ejemplo n.º 30
0
        /// <summary>
        /// Unload contents
        /// </summary>
        public override void UnloadContent()
        {
            Trace.WriteLine("[CharGen] UnloadContent()");


            if (Tileset != null)
            {
                Tileset.Dispose();
            }
            Tileset = null;

            if (Heads != null)
            {
                Heads.Dispose();
            }
            Heads = null;

            if (Font != null)
            {
                Font.Dispose();
            }
            Font = null;

            if (NameFont != null)
            {
                NameFont.Dispose();
            }
            NameFont = null;

            if (Anims != null)
            {
                Anims.Dispose();
            }
            Anims = null;

            if (Batch != null)
            {
                Batch.Dispose();
            }
            Batch = null;
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Dispose
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);


            if (Batch != null)
            {
                Batch.Dispose();
            }
            Batch = null;

            if (Heads != null)
            {
                Heads.Dispose();
            }
            Heads = null;
        }
Ejemplo n.º 32
0
        /// <summary>Gets the list of branches, containing specified <paramref name="revision"/>.</summary>
        /// <param name="revision">Revision which must be present in any resulting branch.</param>
        /// <returns>List of branches, containing specified <paramref name="revision"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="revision"/> == <c>null</c>.</exception>
        public IList <BranchBase> GetBranchesContaining(IRevisionPointer revision)
        {
            Verify.Argument.IsValidRevisionPointer(revision, Repository, nameof(revision));

            var refs = Repository.Accessor.QueryBranches.Invoke(
                new QueryBranchesParameters(QueryBranchRestriction.All, BranchQueryMode.Contains, revision.Pointer));
            var heads   = refs.Heads;
            var remotes = refs.Remotes;
            var count   = heads.Count + remotes.Count;

            if (count == 0)
            {
                return(new BranchBase[0]);
            }
            var res = new List <BranchBase>(count);

            lock (Heads.SyncRoot)
            {
                foreach (var head in heads)
                {
                    var branch = Heads.TryGetItem(head.Name);
                    if (branch != null)
                    {
                        res.Add(branch);
                    }
                }
            }
            lock (Remotes.SyncRoot)
            {
                foreach (var remote in remotes)
                {
                    var branch = Remotes.TryGetItem(remote.Name);
                    if (branch != null)
                    {
                        res.Add(branch);
                    }
                }
            }
            return(res);
        }
Ejemplo n.º 33
0
        /// <summary>
        /// Returns a reference with a given name or <c>null</c>,
        /// if such reference does not exist.
        /// </summary>
        /// <param name="name">Reference name.</param>
        /// <returns>Reference with a given name or <c>null</c>, if such reference does not exist</returns>
        public Reference TryGetReference(string name)
        {
            var head = Heads.TryGetItem(name);

            if (head != null)
            {
                return(head);
            }
            var remote = Remotes.TryGetItem(name);

            if (remote != null)
            {
                return(remote);
            }
            var tag = Tags.TryGetItem(name);

            if (tag != null)
            {
                return(tag);
            }
            return(null);
        }
Ejemplo n.º 34
0
        private void Init()
        {
            AppendList("info\\tool.txt", Tools);
            AppendList("info\\main.txt", Mains);
            AppendList("info\\sub.txt", Subs);
            AppendList("info\\head.txt", Heads);
            AppendList("info\\body.txt", Bodys);
            AppendList("info\\accessory.txt", Accessorys);
            AppendList("info\\material.txt", Materials);
            AppendList("info\\synthesis.txt", Synthesises);
            AppendList("info\\member.txt", Member);
            AppendList("info\\skill.txt", Skill);
            AppendList("info\\title.txt", Title);

            Mains.Sort();
            Subs.Sort();
            Heads.Sort();
            Bodys.Sort();
            Accessorys.Sort();
            Materials.Sort();
            Synthesises.Sort();
        }
	public static Vector3[] createMetro(Heads h,GameObject object2,GameObject object3){

		Vector3[] rPoints = new Vector3[h.elems.Count*4];
		
		int i = 0;

		foreach (Elem el in h.elems) {
			


			int r = Random.Range (3, 11);
						GameObject c; 
						if (r > 2) {
							for (int j=0;j<4;j++){
								r = Random.Range (0, 3);
								int p = pq[j*2];
								int q = pq[j*2+1];
								if (r<2){
										if (r == 0){
											c = (GameObject)Instantiate (object2, new Vector3 ((el.p.y - 1 - 0.25f*p) * Field.tile * ratio, Field.mat [el.p.x, el.p.y].height * 512, (el.p.x - 1 - 0.25f*q) * Field.tile * ratio), Quaternion.identity);
										}else{
												c = (GameObject)Instantiate (object3, new Vector3 ((el.p.y - 1 - 0.25f*p) * Field.tile * ratio, Field.mat [el.p.x, el.p.y].height * 512, (el.p.x - 1 - 0.25f*q) * Field.tile * ratio), Quaternion.identity);
										}
										c.transform.position = new Vector3 (c.transform.position.x, (float)(c.transform.position.y + disp * c.transform.localScale.y / 2-5), c.transform.position.z);
										c.transform.eulerAngles = new Vector3 (c.transform.rotation.x, Random.Range (0, 360), c.transform.rotation.z);
								}
							}
								

						}
		
			rPoints[i++] = new Vector3((el.p.y - 1) * Field.tile * ratio-Field.tile*ratio/2, el.height*1000, (el.p.x - 1) * Field.tile * ratio-Field.tile*ratio/2);
			rPoints[i++] = new Vector3((el.p.y - 1) * Field.tile * ratio-Field.tile*ratio/2, el.height*1000, (el.p.x - 1) * Field.tile * ratio+Field.tile*ratio/2);
			rPoints[i++] = new Vector3((el.p.y - 1) * Field.tile * ratio+Field.tile*ratio/2, el.height*1000, (el.p.x - 1) * Field.tile * ratio+Field.tile*ratio/2);
			rPoints[i++] = new Vector3((el.p.y - 1) * Field.tile * ratio+Field.tile*ratio/2, el.height*1000, (el.p.x - 1) * Field.tile * ratio-Field.tile*ratio/2);


		}

		draw (rPoints);
		return rPoints;
	}
	public static bool checkMoisAndTemp(Heads h){
		return true;
	}
	public static Vector3[] createVillage(Heads h,GameObject object1){
		int numRows=3;

		Vector3[] rPoints = new Vector3[h.elems.Count*4];
		


		if (Mathf.Abs (h.c.west.x - h.c.east.x) < numRows * Field.tile)
						numRows = 2;

		foreach (Elem el in h.elems){

			GameObject c = (GameObject)Instantiate (object1, new Vector3 ((el.p.y-1)* Field.tile*ratio,Field.mat [el.p.x, el.p.y].height *512,(el.p.x-1)* Field.tile*ratio), Quaternion.identity);
			c.transform.position = new Vector3(c.transform.position.x, (float)(c.transform.position.y + disp*c.transform.localScale.y/2), c.transform.position.z);
			c.transform.eulerAngles = new Vector3(c.transform.rotation.x, Random.Range(0, 360), c.transform.rotation.z);
			if (el.height>=0.2)
			for (int i=0;i<4;i++){		
				int x = Random.Range (0,11);
				if (x<=5){
					int p,q;
					p=pq[i*2];
					q=pq[i*2+1];
					c = (GameObject)Instantiate (object1, new Vector3 ((el.p.y-1)* Field.tile*ratio-p*50,Field.mat [el.p.x, el.p.y].height *512,(el.p.x-1)* Field.tile*ratio-q*50), Quaternion.identity);
					c.transform.position = new Vector3(c.transform.position.x, (float)(c.transform.position.y + disp*c.transform.localScale.y/2-5), c.transform.position.z);
					c.transform.eulerAngles = new Vector3(c.transform.rotation.x, Random.Range(0, 360), c.transform.rotation.z);
				}
			}

			/*rPoints[m++] = new Vector3((el.p.y - 1) * Field.tile * ratio-Field.tile*ratio/2, el.height*1000, (el.p.x - 1) * Field.tile * ratio-Field.tile*ratio/2);
			rPoints[m++] = new Vector3((el.p.y - 1) * Field.tile * ratio-Field.tile*ratio/2, el.height*1000, (el.p.x - 1) * Field.tile * ratio+Field.tile*ratio/2);
			rPoints[m++] = new Vector3((el.p.y - 1) * Field.tile * ratio+Field.tile*ratio/2, el.height*1000, (el.p.x - 1) * Field.tile * ratio+Field.tile*ratio/2);
			rPoints[m++] = new Vector3((el.p.y - 1) * Field.tile * ratio+Field.tile*ratio/2, el.height*1000, (el.p.x - 1) * Field.tile * ratio-Field.tile*ratio/2);
			*/

		}

		draw (rPoints);

		return rPoints;
	}
Ejemplo n.º 38
0
	static void connectedComponents(){
		int i, j, k=1;
		int n=0;


		while (k<=mat.Length-4*size+4) {
			if (mat[i = (((k-1)/(size-2))+1), j = (((k-1)%(size-2))+1)].available==0){
				Heads h = new Heads();
				cc.Add (h);
				cc[n].elems = bfs(i, j, n);
				n++;
			}
			k++;
		}
	}
	public static bool checkMoisAndTemp(Heads h){
		/*foreach (Elem el in h.elems) {
			if(el.temperature || el.moisture) return false;//to do
		}*/
		return true;
	}