Помогите решить ошибку в скрипте. Не смог разобраться - Форум Игроделов
Пн, 10 Фев 2025, 11:24 
 
Приветствую Вас Гость Главная | Регистрация | Вход
Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Помогите решить ошибку в скрипте. Не смог разобраться
ZylaksДата: Вт, 02 Июл 2013, 23:48 | Сообщение # 1
Нет аватара
 
Сообщений: 10
Награды: 0
Репутация: 15
Статус: Offline
Код
using UnityEngine;
using System.Collections;
using System;

public class BaseCharacter : MonoBehaviour {
private string _name;
private int _level;
private uint _freeExp;

private Attribute[] _primaryAttribute;
private Vital[] _vital;
private Skill[] _skill;

public void Awake() {
_name = string.Empty;
_level = 0;
_freeExp = 0;

_primaryAttribute = new Attribute[Enum.GetValues(typeof(AttributeName)).Length];
_vital = new Vital[Enum.GetValues(typeof(VitalName)).Length];
_skill = new Skill[Enum.GetValues(typeof(SkillName)).Length];
}
   
   
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

public string name {
get {return _name; }  
set {_name = value; }
}

public int Level {
get{ return _level; }
set{ _level = value; }
}

public uint FreeExp {
get{ return _freeExp; }
set{ _freeExp = value; }
}

public void AddExp(uint exp) {
_freeExp += exp;
    
   CalculateLevel();
  }
   
   
  //
  public void CalculateLevel() {
  }

   
  private void SetupPrimaryAttributes() {
   for(int cnt = 0; cnt < _primaryAttribute.Length; cnt++) {
    _primaryAttribute[cnt] = new Attribute();
   }
  }
   
  private void SetupVitals() {
   for(int cnt = 0; cnt < _vital.Length; cnt++) {
    _vital[cnt] = new Vital();
   }
  }
   
  private void SetupSkills() {
   for(int cnt = 0; cnt < _primaryAttribute.Length; cnt++) {
    _skill[cnt] = new Skill();
   }
  }
}


Ошибка error CS0122: `Skill.Skill()' is inaccessible due to its protection level
76я строчка
 
Сообщение
Код
using UnityEngine;
using System.Collections;
using System;

public class BaseCharacter : MonoBehaviour {
private string _name;
private int _level;
private uint _freeExp;

private Attribute[] _primaryAttribute;
private Vital[] _vital;
private Skill[] _skill;

public void Awake() {
_name = string.Empty;
_level = 0;
_freeExp = 0;

_primaryAttribute = new Attribute[Enum.GetValues(typeof(AttributeName)).Length];
_vital = new Vital[Enum.GetValues(typeof(VitalName)).Length];
_skill = new Skill[Enum.GetValues(typeof(SkillName)).Length];
}
   
   
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}

public string name {
get {return _name; }  
set {_name = value; }
}

public int Level {
get{ return _level; }
set{ _level = value; }
}

public uint FreeExp {
get{ return _freeExp; }
set{ _freeExp = value; }
}

public void AddExp(uint exp) {
_freeExp += exp;
    
   CalculateLevel();
  }
   
   
  //
  public void CalculateLevel() {
  }

   
  private void SetupPrimaryAttributes() {
   for(int cnt = 0; cnt < _primaryAttribute.Length; cnt++) {
    _primaryAttribute[cnt] = new Attribute();
   }
  }
   
  private void SetupVitals() {
   for(int cnt = 0; cnt < _vital.Length; cnt++) {
    _vital[cnt] = new Vital();
   }
  }
   
  private void SetupSkills() {
   for(int cnt = 0; cnt < _primaryAttribute.Length; cnt++) {
    _skill[cnt] = new Skill();
   }
  }
}


Ошибка error CS0122: `Skill.Skill()' is inaccessible due to its protection level
76я строчка

Автор - Zylaks
Дата добавления - 02 Июл 2013 в 23:48
DjeeZДата: Ср, 03 Июл 2013, 00:24 | Сообщение # 2
 
Сообщений: 270
Награды: 8
Репутация: 291
Статус: Offline
Код не читал, но пишет, что недоступна private переменная.
msdn.microsoft.com/ru-ru


Сообщение отредактировал DjeeZ - Ср, 03 Июл 2013, 01:14
 
СообщениеКод не читал, но пишет, что недоступна private переменная.
msdn.microsoft.com/ru-ru

Автор - DjeeZ
Дата добавления - 03 Июл 2013 в 00:24
ЛевшаДата: Ср, 03 Июл 2013, 13:17 | Сообщение # 3
Черный Волк
 
Сообщений: 7257
Награды: 30
Репутация: 3313
Статус: Offline
Такое обычно бывает когда из другого скрипта пытаешся обратится к приватной переменной.

X.cor.R (Prologue)
 
СообщениеТакое обычно бывает когда из другого скрипта пытаешся обратится к приватной переменной.

Автор - Левша
Дата добавления - 03 Июл 2013 в 13:17
  • Страница 1 из 1
  • 1
Поиск:
Загрузка...

Game Creating CommUnity © 2009 - 2025