• Benvenuto in Making Videogames!
  • Dai sfogo alla tua fantasia!
  • Crea il tuo Videogioco!
Benvenuto ospite! Login Registrati




Valutazione discussione:
  • 2 voto(i) - 5 media
  • 1
  • 2
  • 3
  • 4
  • 5
Aiuto Script
#1
salve ragazzi,avrei bisogno di un aiuto per completare uno script,che ho preso da un Tutorial di un team di ragazzi che vuole finire un fps,che però non so se continueranno a farlo :/,comunque lo Script che ho preso da loro è questo:
using UnityEngine;
using System.Collections;

public class WeaponScript : MonoBehaviour {

public Set[] Weapons;
public Set currentweapons;

// Use this for initialization
void Start ()
{
currentweapon = Weapons[0];
CurrentWeapon.wepTrasform.animation.Play(currentWeapon.DrawAnim);
}
// Update is called once per frame
void Update ()
{
if (Input.GetMouseButton(0))
{
Currentweapon.wepTrasform.animation.Play(currentWeapon.fireAnim);
}
if(Input.GetKey(keyCode.R))
{
CurrentWeapon.wepTrasform.Animation.Play(currentWeapons.reloadAnim);
}
}
}
[System.Serializable]
public class Weapon
{
public string name;
public Transform wepTrasform;
public string fireAnim, drawAnim, reloadAnim;
}


ma quando vado a far partire il gioco su unity per vedere se funziona tutto sulla console mi escono 7 errori:
-Assets/weapons2.cs(22,26): error CS1502: The best overloaded method match for `UnityEngine.Input.GetKey(string)' has some invalid arguments
-Assets/weapons2.cs(22,33): error CS0103: The name `keyCode' does not exist in the current context
-Assets/weapons2.cs(20,25): error CS0103: The name `Currentweapon' does not exist in the current context
-Assets/weapons2.cs(13,17): error CS0103: The name `CurrentWeapon' does not exist in the current context
-Assets/weapons2.cs(12,17): error CS0103: The name `currentweapon' does not exist in the current context
-Assets/weapons2.cs(22,26): error CS1503: Argument `#1' cannot convert `object' expression to type `string'
-Assets/weapons2.cs(24,25): error CS0103: The name `CurrentWeapon' does not exist in the current context

allora ho provato a modificarlo aggiungendo "public static Weapons",magari risolvevo qualcosa ed ecco il risultato:
2)
using UnityEngine;
using System.Collections;

public class WeaponScript : MonoBehaviour
{

public Weapons[] Weapons ;
public Weapons Currentweapons ;
public static Weapons

// Use this for initialization
void Start ()
{
Currentweapon = Weapons[0];
Currentweapon.wepTrasform.animation.Play(currentWeapon.DrawAnim);
}
// Update is called once per frame
void Update ()
{
if (Input.GetMouseButton(0))
{
Currentweapon.wepTrasform.animation.Play(currentWeapon.fireAnim);
}
if(Input.GetKey(keyCode.R))
{
Currentweapon.wepTrasform.Animation.Play(currentWeapons.reloadAnim);
}
}
}
[System.Serializable]
public class Weapon
{
public string name;
public Transform wepTrasform;
public string fireAnim,drawAnim,reloadAnim;
}

non funziona lo stesso,
però adesso mi da solo un errore:
-Assets/WeaponScript.cs(12,20): error CS1519: Unexpected symbol `void' in class, struct, or interface member declaration

ormai mi sono fermato 4 giorni su questo script e non so più cosa fare :/.spero che mi potrete aiutare Big Grin
 
Rispondi
  


Messaggi in questa discussione
Aiuto Script - da LatinMan - 22-08-2014, 03:37 PM
RE: Aiuto Script - da Blackg96 - 22-08-2014, 05:04 PM
RE: Aiuto Script - da LatinMan - 22-08-2014, 07:00 PM
RE: Aiuto Script - da Blackg96 - 22-08-2014, 11:29 PM
RE: Aiuto Script - da LatinMan - 29-08-2014, 12:52 PM
RE: Aiuto Script - da Blackg96 - 29-08-2014, 05:42 PM
RE: Aiuto Script - da LatinMan - 04-09-2014, 11:16 AM
RE: Aiuto Script - da Blackg96 - 04-09-2014, 12:53 PM
RE: Aiuto Script - da LatinMan - 04-09-2014, 04:04 PM
RE: Aiuto Script - da Blackg96 - 04-09-2014, 06:17 PM
RE: Aiuto Script - da WilSoft90 - 04-09-2014, 06:46 PM
RE: Aiuto Script - da LatinMan - 04-09-2014, 10:31 PM
RE: Aiuto Script - da Blackg96 - 04-09-2014, 11:50 PM
RE: Aiuto Script - da WilSoft90 - 05-09-2014, 11:57 AM
RE: Aiuto Script - da Blackg96 - 05-09-2014, 12:23 PM
RE: Aiuto Script - da LatinMan - 06-09-2014, 03:19 PM
RE: Aiuto Script - da Blackg96 - 06-09-2014, 03:39 PM

Discussioni simili
Discussione Autore Risposte Letto Ultimo messaggio
  Aiuto script sparo gioco 2D fedekikko 4 616 22-04-2015, 03:31 PM
Ultimo messaggio: Blackg96
  Aiuto problema script per attacco fedekikko 13 1,039 22-04-2015, 11:14 AM
Ultimo messaggio: Blackg96
  Richiesta aiuto script per guidare macchina. davidecreatoreapp 8 931 27-03-2015, 11:56 AM
Ultimo messaggio: davidecreatoreapp
  Aiuto Script Tech98 5 681 25-04-2014, 11:45 PM
Ultimo messaggio: adriqueru99
  Unity 3d Aiuto script kaosmoda 5 957 07-12-2012, 12:30 PM
Ultimo messaggio: Exorcist

Vai al forum:


Browsing: 1 Ospite(i)