Quantcast
Channel: Latest Questions by soft_sound
Viewing all articles
Browse latest Browse all 30

error CS0246 missing type or namespace...

$
0
0
Assets/Scripts/CaveIntroScr/CharacterClasses/BaseCharacterScr.cs(12,17): error CS0246: The type or namespace name `Vigor' could not be found. Are you missing a using directive or an assembly reference? Assets/Scripts/CaveIntroScr/CharacterClasses/BaseCharacterScr.cs(13,17): error CS0246: The type or namespace name `Skill' could not be found. Are you missing a using directive or an assembly reference? ---------------------- I'm quite annoyed with this error. I can't figure why it won't recognize my references. I'm sure the names are correct because I've copied and pasted the names. It recognizes one reference but doesn't like the other references. *All the scripts are in the same folder if that makes any difference. I'm new to C# so I could be doing this all wrong because I'm slightly tweaking a tutorial I'm following. Here is a snippet of what I'm doing. The bad formatting is from the code sample button. Any advice would be useful. Not sure if it matters, I'm using Unity 3.5.5f... and MD 2.8.2... Oh and ModifiedStatScr inherits from BaseStatScr just like in my AttributeScr script, not sure if that matters either... I hope this is just a typo and not some logic error... Script 1 --- using UnityEngine; using System.Collections; using System; // added for enum class public class BaseCharacterScr : MonoBehaviour { private string _name; private int _level; private uint _freeExp; // no neg #'s private Attribute[] _primaryAttribute; private Vigor[] _vigor; private Skill[] _skill; public void Awake(){ _name = string.Empty; _level = 0; _freeExp =0; //_primaryAttribute = new Attribute[Enum.GetValues(typeof(AttributeName)).Length]; //_vigor = new Vigor[Enum.GetValues(typeof(VigorName)).Length]; //_skill = new Skill[Enum.GetValues(typeof(SkillName)).Length]; }} Here is a script that works. ------ public class AttributeScr : BaseStatScr{ public void Attribute(){ ExpToLevel = 50; LvlModifier = 1.05f; } } public enum AttributeName { Spirit, //- courage/attack Reason, //- logic/skill Nimbleness, //- dextrity, doging and concealment Muse, //- range of possible types of skills Heart, //- Strength/determination Vigor, //- health effects Decorum, //- social skills/grace Readiness, //- Speed, countering, defense Focus //- chances of crit hit and learning abilites faster } Here are scripts that aren't working. ------ public class VigorScr : ModifiedStatScr{ private int _curValue; public void Vigor(){ _curValue = 0; ExpToLevel = 50; LvlModifier =1.1f; } public int CurValue{ get{ if (_curValue > AdjustedBaseValue) _curValue = AdjustedBaseValue; return _curValue; } set{ _curValue = value;} } } public enum VigorName{ Health, Energy, Hunger, Thirst } Next script ------------------------ //tells what skills the character has public class SkillScr : ModifiedStatScr { private bool _known; public void Skill(){ _known = false; ExpToLevel = 25; LvlModifier =1.1f; } public bool Known{ get{ return _known;} set{ _known = value;} } } public enum SkillName{ Melee_Offence, Melee_Defense, Range_Offence }

Viewing all articles
Browse latest Browse all 30

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>