Beispiel #1
0
        public override bool TryPlaceFeatureAtLocation(
            IHexCell cell, Vector3 location, int locationIndex, HexHash hash
            )
        {
            var nodeOnCell = ResourceNodeLocationCanon.GetPossessionsOfOwner(cell).FirstOrDefault();

            if (nodeOnCell == null ||
                (hash.A >= Config.ResourceAppearanceChance && locationIndex % Config.GuaranteedResourceModulo != 0) ||
                !VisibilityCanon.IsResourceVisible(nodeOnCell.Resource)
                )
            {
                return(false);
            }

            AddFeature(nodeOnCell.Resource.AppearancePrefab, location, hash);
            return(true);
        }
Beispiel #2
0
        private void SetResourceNodeDisplay(IHexCell cell)
        {
            var resourceNodeAt = ResourceNodePositionCanon.GetPossessionsOfOwner(cell).FirstOrDefault();

            if (resourceNodeAt != null)
            {
                if (VisibilityCanon.IsResourceVisible(resourceNodeAt.Resource))
                {
                    ResourceNodeDisplay.gameObject.SetActive(true);
                    ResourceNodeDisplay.DisplayNode(resourceNodeAt);
                }
                else
                {
                    ResourceNodeDisplay.gameObject.SetActive(false);
                }
            }
            else
            {
                ResourceNodeDisplay.gameObject.SetActive(false);
            }
        }