Hey guys so I’ve gotten quite a bit down with the basics of unity and I can understand most of the syntax with Java and C# but I’ve had some problems creating my own scripts and getting them to work the way that I want too so I’ve relied heavily on tutorials and reviewing other scripts that people have written. I guess its that I know what i want to do and how to do it I just can’t do it… if that makes any sense. With that here’s my issue. I’ve gotten my characters to move around with my scripts with my character controller and I can fire off particles for skills with this script:
var btnTexture : Texture;
var bullitPrefab:Transform;
var SpellSound : AudioClip;
function OnGUI() {
if (!btnTexture) {
Debug.LogError("Please assign a texture on the inspector");
return;
}
if (GUI.Button(Rect(506,Screen.height - 105,35,35),btnTexture))
{
audio.PlayOneShot(SpellSound);
var bullit = Instantiate(bullitPrefab, transform.position, Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 200);
}
}
However my issue is inputting in a command such as
public void Fire1() {
animation.CrossFade("Fire1");
for an animation to trigger with the skill once its cast. I was trying to work it out so that I wouldn’t have to script in the animation skill with my CharacterInput script and trigger the skill based off of animation events because I wanted the players to have the freedom to change up skills in a skill bar. If anyone can offer any kind of advice on this it would be much appreciated. Thanks for taking the time to read this over sorry I’m not an indept coder/programer just a guy that picked up unity a few months ago.
Regards,
-Alio