コード例 #1
0
ファイル: Hud.cs プロジェクト: Blkx-Darkreaper/Unity
        protected void DrawAvailableActions()
        {
            if (profile.Player == null)
            {
                return;
            }
            if (profile.Player.SelectedEntity == null)
            {
                return;
            }

            bool ownedByPlayer = profile.Player.SelectedEntity.IsOwnedByPlayer(profile.Player);
            if (ownedByPlayer == false)
            {
                return;
            }

            ResetSlider();
            string[] allActions = profile.Player.SelectedEntity.Actions;
            previousSelection = profile.Player.SelectedEntity;
        }
コード例 #2
0
ファイル: Selectable.cs プロジェクト: Blkx-Darkreaper/Unity
        private void ChangeSelection(Selectable otherEntity, Player player)
        {
            if (otherEntity == this)
            {
                return;
            }

            SetSelection(false);
            if (player.SelectedEntity != null)
            {
                player.SelectedEntity.SetSelection(false);
            }

            player.SelectedEntity = otherEntity;
            playingArea = Hud.GetPlayingArea();
            otherEntity.SetSelection(true);
        }
コード例 #3
0
ファイル: UserInput.cs プロジェクト: Blkx-Darkreaper/Unity
        protected void SelectEntity(Selectable entityToSelect)
        {
            Player player = profile.Player;
            if (player == null)
            {
                return;
            }

            player.SelectedEntity = entityToSelect;
            entityToSelect.SetSelection(true);
        }
コード例 #4
0
ファイル: Player.cs プロジェクト: Blkx-Darkreaper/Unity
 //public void SpawnStructure(string structureName, Vector3 buildPoint, Selectable builder, Rect playingArea)
 //{
 //    GameObject structureToSpawn = (GameObject)Instantiate(GameManager.ActiveInstance.GetStructurePrefab(structureName),
 //        buildPoint, new Quaternion());
 //    constructionSite = structureToSpawn.GetComponent<Structure>();
 //    if (constructionSite != null)
 //    {
 //        IsSettingConstructionPoint = true;
 //        constructionSite.SetTransparencyMaterial(NotAllowedMaterial, true);
 //        constructionSite.SetColliders(false);
 //        constructionSite.playingArea = playingArea;
 //    }
 //    else
 //    {
 //        Destroy(structureToSpawn);
 //    }
 //}
 //public void SetConstructionPoint()
 //{
 //    Vector3 constructionPosition = UserInput.GetHitPoint();
 //    constructionPosition.y = 0;
 //    constructionSite.transform.position = constructionPosition;
 //}
 protected void TakeOwnershipOfEntity(Selectable selectable, string entityType)
 {
     GameObject group = transform.Find(entityType).gameObject;
     selectable.transform.parent = group.transform;
 }