Esempio n. 1
0
    public void Start()
    {
        zasoby     = gameObject.GetComponent <CardResources>();
        properties = gameObject.GetComponent <Properties>();
        statistics = gameObject.GetComponent <Statistics>();

        //Transform DescriptionTrans = this.transform.Find("Description");
        Transform attackTextTrans = this.transform.Find("Attack").transform.Find("Text");

        attackText = attackTextTrans.GetComponentInChildren <Text>();

        Transform defeseTextTrans = this.transform.Find("Defense").transform.Find("Text");

        defenseText = defeseTextTrans.GetComponentInChildren <Text>();


        DescriptionImage = this.transform.Find("DescriptionPanel").gameObject;

        descriptionText      = DescriptionImage.GetComponentInChildren <Text>();
        descriptionText.text = properties.description;

        DescriptionImage.SetActive(false);


        //descriptionText = DescriptionImage.GetComponentInChildren<Text>();
        //descriptionText.text = "OPIS";
    }
Esempio n. 2
0
 /// <summary>
 ///
 /// Function call for selecting a resource from the list
 ///
 /// </summary>
 /// <param name="toSelect">Boolean function to say if the resource is being selected or deselected</param>
 /// <param name="selectedResource">The resource which has been selected</param>
 /// <param name="resourceList">The resource list object which caused the click event</param>
 public void SelectResource(bool toSelect, CardResources selectedResource, ResourceList resourceList)
 {
     //If a resource is being selected, then add it to the list of selected resource
     if (toSelect)
     {
         selectedResources.Add(selectedResource);
         //If only one resource is selected, then removes the resource from the other list and sets up the class data as the default list
         if (selectedResources.Count == 1)
         {
             foreach (var list in resourceLists)
             {
                 if (list != resourceList)
                 {
                     list.RefreshResourceList(selectedResource);
                 }
             }
             SelectClassData(Classes.ClassList.Default);
         }
         //If both resources are selected, then selects the class based on the two resources selected
         else if (selectedResources.Count == 2)
         {
             SelectClassData(selectedResources);
         }
         else
         {
             throw new Exception("Too many resource selected");
         }
     }
     //If a resource is being deselected, then remove it from the list of selected resource
     else
     {
         selectedResources.Remove(selectedResource);
         //If there are no resources selected refresh all the lists with all resources and selects the default class
         if (selectedResources.Count == 0)
         {
             foreach (var list in resourceLists)
             {
                 list.RefreshResourceList();
             }
             SelectClassData(Classes.ClassList.Default);
         }
         //If there is only one resource selected, refreshes the list removed from, exempting the resource selected in the other list
         else if (selectedResources.Count == 1)
         {
             foreach (var list in resourceLists)
             {
                 if (list == resourceList)
                 {
                     list.RefreshResourceList(selectedResources.FirstOrDefault());
                 }
             }
             SelectClassData(Classes.ClassList.Default);
         }
         else
         {
             throw new Exception("Too many resource selected");
         }
     }
 }
Esempio n. 3
0
 public bool checkIfEnoughResources(CardResources player, CardResources karta)
 {
     if (player.like >= karta.like && player.snap >= karta.snap && player.tweet >= karta.tweet)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 4
0
 void Start()
 {
     zasoby             = gameObject.GetComponent <CardResources>();
     zasoby.like        = Const.startMana;
     zasoby.tweet       = Const.startMana;
     zasoby.snap        = Const.startMana;
     cardsInHand        = 0;
     alreadyDraftedCard = false;
 }
Esempio n. 5
0
 void Start()
 {
     zasoby = gameObject.GetComponent<CardResources>();
     zasoby.like = Const.startMana;
     zasoby.tweet = Const.startMana;
     zasoby.snap = Const.startMana;
     cardsInHand = 0;
     alreadyDraftedCard = false;
 }
Esempio n. 6
0
    public override void ResourceConvert(CardResources newResource)
    {
        base.ResourceConvert(newResource);

        foreach (var ability in Abilities)
        {
            ability.ConvertResource(newResource);
        }
    }
Esempio n. 7
0
 void Start()
 {
     player       = GameObject.Find("Gracz");
     zasoby       = player.GetComponent <CardResources>();
     textStats    = this.GetComponentInChildren <Text>();
     zasoby.like  = Const.startMana;
     zasoby.tweet = Const.startMana;
     zasoby.snap  = Const.startMana;
     player.GetComponent <Statistics>().hp     = Const.life;
     player.GetComponent <Statistics>().isCard = false;
 }
Esempio n. 8
0
        public static void CreateCardResource()
        {
            CardResources asset = ScriptableObject.CreateInstance <CardResources>();

            AssetDatabase.CreateAsset(asset, "Assets/Scriptable Objects/CardResources/NewScripableObject.asset");
            AssetDatabase.SaveAssets();

            EditorUtility.FocusProjectWindow();

            Selection.activeObject = asset;
        }
Esempio n. 9
0
 void Start()
 {
     player = GameObject.Find("Gracz");
     zasoby = player.GetComponent<CardResources>();
     textStats = this.GetComponentInChildren<Text>();
     zasoby.like = Const.startMana;
     zasoby.tweet = Const.startMana;
     zasoby.snap = Const.startMana;
     player.GetComponent<Statistics>().hp = Const.life;
     player.GetComponent<Statistics>().isCard = false;
 }
Esempio n. 10
0
    /// <summary>
    ///
    /// Obtain a particular resource colour
    ///
    /// </summary>
    public Color GetResourceColour(CardResources neededResource)
    {
        var resourceColour = new Color();

        resourceColour = resourceColours.FirstOrDefault(x => x.Resource == neededResource).resourceColour;
        if (resourceColour == null)
        {
            resourceColour = new Color();
        }
        return(resourceColour);
    }
    /// <summary>
    ///
    /// Initialise the class list object
    ///
    /// </summary>
    public void InitResourceListObject(CardResources _cardResource, ResourceList _resourceList)
    {
        resourceList = _resourceList;
        cardResource = _cardResource;

        resourceName.text        = cardResource.ToString().ToUpper();
        resourceBackground.color = GameManager.instance.colourManager.GetResourceColour(cardResource);
        resourceIcon.sprite      = GameManager.instance.iconManager.GetIcon(cardResource);

        resourceDescriptionText.text = Resource.GetResoourceDescription(cardResource);
        resourceDescriptionArea.SetActive(false);
    }
Esempio n. 12
0
    public void SetTainted(CardResources TaintEffect, CardBehaviours TaintBehaviour, bool HideEffect)
    {
        if (TaintBehaviour != null)
        {
            if (TaintBehaviour.GetType() == typeof(PanicBehaviour))
            {
                PanicMarker.SetActive(true);
            }
            TaintCardBehaviour.Add(TaintBehaviour);

            if (!HideEffect)
            {
                TaintInvolved.SetActive(true);
            }
        }
        if (TaintEffect != null)
        {
            int i = 0;
            TaintCardEffect.Add(TaintEffect);
            foreach (var marker in TaintMarker)
            {
                if (TaintEffect == null)
                {
                    break;
                }
                if (!marker.activeSelf)
                {
                    marker.SetActive(true);
                    TaintIcon[i].sprite = TaintEffect.Icon;
                    if (!HideEffect)
                    {
                        if (TaintEffect.Value > 0) //Plus
                        {
                            TaintPlus[i].gameObject.SetActive(true);
                            TaintPlus[i].fillAmount = (1.0f / 3.0f) * (float)TaintEffect.power;
                            TaintInvolved.SetActive(true);
                        }
                        else //Minus
                        {
                            TaintMinus[i].gameObject.SetActive(true);
                            TaintMinus[i].fillAmount = (1.0f / 3.0f) * (float)TaintEffect.power;
                            TaintInvolved.SetActive(true);
                        }
                    }

                    break;
                }
                i++;
            }
        }
    }
Esempio n. 13
0
 public void ConvertResource(CardResources newResource)
 {
     if (ResourceCost.Count != 0)
     {
         ResourceCost = new List <Resource>()
         {
             new Resource(newResource, TotalResource)
         };
         Resources = new List <CardResources> {
             newResource
         };
         ResourcesConverted = true;
     }
 }
Esempio n. 14
0
 public virtual void ResourceConvert(CardResources newResource)
 {
     if (ResourceCost.Count != 0)
     {
         ResourceCost = new List <Resource>()
         {
             new Resource(newResource, TotalResource)
         };
         Resources = new List <CardResources> {
             newResource
         };
         ResourceConvertedTo = newResource;
     }
 }
Esempio n. 15
0
    /// <summary>
    ///
    /// Function to call when a resource in the list is selected
    ///
    /// </summary>
    /// <param name="toSelect">Whether the resource is being selected (true) or deselected (false)</param>
    public void SelectResource(CardResources selectedResource, bool toSelect)
    {
        //Loops through each resource object and shows or hides them based on whether the resource is selected or not
        foreach (var resourceObject in resourceListObjects)
        {
            if (resourceObject.cardResource != selectedResource)
            {
                resourceObject.gameObject.SetActive(!toSelect);
            }
        }

        isSelected = toSelect;
        newDeckUI.SelectResource(toSelect, selectedResource, this);
    }
Esempio n. 16
0
    /// <summary>
    ///
    /// Gets the status of a particular resource- i.e. whether it is increase, decreased or not changed
    ///
    /// </summary>
    private StatisticStatuses GetResourceStatus(CardResources resource)
    {
        if (ResourceConvertedTo.HasValue)
        {
            return(StatisticStatuses.Converted);
        }

        var currentCost = ResourceCost.Single(x => x.ResourceType == resource).Value;
        var defaultCost = DefaultCost.Single(x => x.ResourceType == resource).Value;

        //Note that the signs are flipped as cost is always negative
        if (currentCost > defaultCost)
        {
            return(StatisticStatuses.Buffed);
        }
        else if (currentCost < defaultCost)
        {
            return(StatisticStatuses.Debuffed);
        }
        else
        {
            return(StatisticStatuses.None);
        }
    }
Esempio n. 17
0
 public bool checkIfEnoughResources(CardResources player, CardResources karta)
 {
     if (player.like >= karta.like && player.snap >= karta.snap && player.tweet >= karta.tweet)
         return true;
     return false;
 }
Esempio n. 18
0
 public void drainResources(CardResources player, CardResources karta)
 {
     player.like  -= karta.like;
     player.snap  -= karta.snap;
     player.tweet -= karta.tweet;
 }
Esempio n. 19
0
    public void Start()
    {
        zasoby = gameObject.GetComponent<CardResources>();
        properties = gameObject.GetComponent<Properties>();
        statistics = gameObject.GetComponent<Statistics>();

        //Transform DescriptionTrans = this.transform.Find("Description");
        Transform attackTextTrans = this.transform.Find("Attack").transform.Find("Text");
        attackText = attackTextTrans.GetComponentInChildren<Text>();

        Transform defeseTextTrans = this.transform.Find("Defense").transform.Find("Text");
        defenseText = defeseTextTrans.GetComponentInChildren<Text>();

        DescriptionImage = this.transform.Find("DescriptionPanel").gameObject;

        descriptionText = DescriptionImage.GetComponentInChildren<Text>();
        descriptionText.text = properties.description;

        DescriptionImage.SetActive(false);

        //descriptionText = DescriptionImage.GetComponentInChildren<Text>();
        //descriptionText.text = "OPIS";
    }
Esempio n. 20
0
 /// <summary>
 ///
 /// Initialise the Player Resource Object. To be called in the subclasses of this object
 ///
 /// </summary>
 protected void InitPlayerResource(CardResources resourceType)
 {
     SetTierLevel(TierLevel);
     ResourceType = resourceType;
 }
Esempio n. 21
0
 public static string GetResoourceDescription(CardResources cardResource)
 {
     ResourceDescriptions.TryGetValue(cardResource, out string description);
     return(description);
 }
Esempio n. 22
0
 public Resource(CardResources resourceType, int value)
 {
     ResourceType = resourceType;
     Value        = value;
 }
Esempio n. 23
0
 /// <summary>
 ///
 /// Gets a player resource of a particular type
 ///
 /// </summary>
 public PlayerResource GetPlayerResource(CardResources resource)
 {
     return(PlayerResources.FirstOrDefault(x => x.ResourceType == resource));
 }
Esempio n. 24
0
 public void drainResources(CardResources player, CardResources karta)
 {
     player.like -= karta.like;
     player.snap -= karta.snap;
     player.tweet -= karta.tweet;
 }