вот мой код под проблемой, я думаю, это оператор if под вертикальной линией input.getaxis
using UnityEngine;
using System.Collections;
public class moveit : MonoBehaviour {
private Collectable shoot;
private static int ammun;
public static bool defense;
public arrow Arrow;
public float Speed = 1f;
private float movex = 0f;
private float movey = 0f;
public static Animator animator;
GameObject projectile = null;
// Use this for initialization
void Start () {
animator = GetComponent ();
shoot = GetComponent();
}
// Update is called once per frame
void Update () {
ammun = Collectable.ammo;
// the movement and aanimation code----------------------
movex = Input.GetAxis ("Horizontal");
if (movex == 0f){
animator.SetInteger ("AnimState", 1);
}else if(movex == 1f){
animator.SetInteger ("AnimState", 2);
}else if(movex == -1f){
animator.SetInteger ("AnimState", 3);
}
movey = Input.GetAxis ("Vertical");
if(ammun == 1 && movey == -1){
GameObject projectile = Instantiate (projectile, new Vector3 (0, 0, 0), Quaternion.identity) as GameObject;
}
rigidbody2D.velocity = new Vector2 (movex * Speed, movey * Speed); }
//-----------------------------------------------------------------------------
}
Подробнее здесь: https://stackoverflow.com/questions/309 ... ror-cs0165
Скрипт C# unity 2d создает клон Ошибка CS0165 ⇐ C#
Место общения программистов C#
-
Anonymous
1731433495
Anonymous
вот мой код под проблемой, я думаю, это оператор if под вертикальной линией input.getaxis
using UnityEngine;
using System.Collections;
public class moveit : MonoBehaviour {
private Collectable shoot;
private static int ammun;
public static bool defense;
public arrow Arrow;
public float Speed = 1f;
private float movex = 0f;
private float movey = 0f;
public static Animator animator;
GameObject projectile = null;
// Use this for initialization
void Start () {
animator = GetComponent ();
shoot = GetComponent();
}
// Update is called once per frame
void Update () {
ammun = Collectable.ammo;
// the movement and aanimation code----------------------
movex = Input.GetAxis ("Horizontal");
if (movex == 0f){
animator.SetInteger ("AnimState", 1);
}else if(movex == 1f){
animator.SetInteger ("AnimState", 2);
}else if(movex == -1f){
animator.SetInteger ("AnimState", 3);
}
movey = Input.GetAxis ("Vertical");
if(ammun == 1 && movey == -1){
GameObject projectile = Instantiate (projectile, new Vector3 (0, 0, 0), Quaternion.identity) as GameObject;
}
rigidbody2D.velocity = new Vector2 (movex * Speed, movey * Speed); }
//-----------------------------------------------------------------------------
}
Подробнее здесь: [url]https://stackoverflow.com/questions/30960911/c-sharp-script-unity-2d-creating-a-clone-error-cs0165[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия