Скрипт C# unity 2d создает клон Ошибка CS0165C#

Место общения программистов C#
Ответить
Anonymous
 Скрипт C# unity 2d создает клон Ошибка CS0165

Сообщение 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); }
//-----------------------------------------------------------------------------
}


Подробнее здесь: https://stackoverflow.com/questions/309 ... ror-cs0165
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»