Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

errors in a script

Discussion in 'Scripting' started by william-ali, Dec 7, 2012.

  1. william-ali

    william-ali

    Joined:
    Dec 4, 2012
    Posts:
    7
    Hello there, im getting some errors in my scripts now and i cant figure out what to change cus it seems right to me this is the errors im getting ::


    Assets/scripts/character classes/ModifiedStat.cs(21,55): error CS1061: Type `ModifyingAttribute' does not contain a definition for `Attribute' and no extension method `Attribute' of type `ModifyingAttribute' could be found (are you missing a using directive or an assembly reference?)

    Assets/scripts/character classes/ModifiedStat.cs(19,18): error CS1061: Type `System.Collections.Generic.List<ModifyingAttribute>' does not contain a definition for `count' and no extension method `count' of type `System.Collections.Generic.List<ModifyingAttribute>' could be found (are you missing a using directive or an assembly reference?)

    and a warning


    Assets/scripts/character classes/ModifiedStat.cs(25,24): warning CS0109: The member `ModifiedStat.AdjustBaseValue' does not hide an inherited member. The new keyword is not required

    Code (csharp):
    1.  
    2. using System.Collections.Generic;
    3.  
    4. public class ModifiedStat : BaseStat {
    5.     private List<ModifyingAttribute> _mods; // en lista av attrubytes some ändrar statsen
    6.     private int _modValue;                  //
    7.    
    8.     public ModifiedStat(){
    9.         _mods = new List<ModifyingAttribute>();
    10.         _modValue = 0 ;
    11.        
    12.     }
    13.    
    14.     public void AddModifier(ModifyingAttribute mod) {
    15.         _mods.Add (mod);
    16.     }
    17.     private void CalculateModValue () {
    18.     _modValue = 0;
    19.        
    20.     if(_mods.count > 0)
    21.             foreach(ModifyingAttribute att in _mods)
    22.                 _modValue += (int)att.Attribute.AdjustedBaseValue * att.ratio;
    23.            
    24.     }
    25.    
    26.     public new int AdjustBaseValue {
    27.         get{return baseValue  + buffValue + _modValue; }
    28.        
    29.     }
    30.    
    31.     public void update() {
    32.         CalculateModValue();
    33.    
    34. }
    35.  
    36.  
    37. }
    38.  
    39. public struct ModifyingAttribute {
    40.     public Attribute attrubute;
    41.     public float ratio;
    42.    
    43. }
    so there is the code, hopefully someone of you will figure it out since i cant see it. thank god for great people here helping out!
     
  2. zilch

    zilch

    Joined:
    Sep 13, 2012
    Posts:
    2
    _mods.count====>_mods.Count
    att.Attribute=====>att.attrubute