Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Casting : MonoBehaviour
- {
- private Animator animator;
- private CharacterController controller;
- private Transform xSpell;
- public Transform spells;
- public Transform spell1;
- public Transform spell2;
- public Transform spell3;
- public Transform spell4;
- public Transform spell5;
- public Transform spell6;
- public Transform spell7;
- public Transform spell8;
- // Use this for initialization
- void Start ()
- {
- controller = GetComponent<CharacterController>();
- animator = GetComponent<Animator>();
- }
- void Update()
- {
- if (controller.isGrounded)
- {
- if (Input.GetKeyDown("1"))
- {
- animator.SetBool("CastFireball", true);
- xSpell = spell1;
- }
- else
- {
- animator.SetBool("CastFireball", false);
- }
- if (Input.GetKeyDown("2"))
- {
- animator.SetBool("CastFireball", true);
- xSpell = spell2;
- }
- else
- {
- animator.SetBool("CastFireball", false);
- }
- /* if (Input.GetKeyDown("3"))
- {
- animator.SetBool("CastFireball", true);
- xSpell = spell3;
- }
- else
- {
- animator.SetBool("CastFireball", false);
- }
- if (Input.GetKeyDown("4"))
- {
- animator.SetBool("CastFireball", true);
- xSpell = spell4;
- }
- else
- {
- animator.SetBool("CastFireball", false);
- }
- if (Input.GetKeyDown("5"))
- {
- animator.SetBool("CastFireball", true);
- xSpell = spell5;
- }
- else
- {
- animator.SetBool("CastFireball", false);
- }
- if (Input.GetKeyDown("6"))
- {
- animator.SetBool("CastFireball", true);
- xSpell = spell6;
- }
- else
- {
- animator.SetBool("CastFireball", false);
- }
- if (Input.GetKeyDown("7"))
- {
- animator.SetBool("CastFireball", true);
- xSpell = spell7;
- }
- else
- {
- animator.SetBool("CastFireball", false);
- }
- if (Input.GetKeyDown("8"))
- {
- animator.SetBool("CastFireball", true);
- xSpell = spell8;
- }
- else
- {
- animator.SetBool("CastFireball", false);
- }
- */
- }
- }
- void SpellCast ()
- {
- Instantiate (xSpell, spells.position, spells.rotation);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement