コード例 #1
0
ファイル: Abilities.cs プロジェクト: Ironhead29/luna
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     lunaCharacterController = GetComponent<LunaCharacterController>();
     playerScript = GetComponent<PlayerScript>();
     pStats = GetComponent<AbilityBar> ();
     fireballSpawn = GameObject.FindGameObjectWithTag("FireballSpawn");
 }
コード例 #2
0
ファイル: FireballController.cs プロジェクト: Ironhead29/luna
        // Use this for initialization
        void Start()
        {
            rigidBody2D = GetComponent<Rigidbody2D>();
            lunaCharacterController = GameObject.FindGameObjectWithTag("Player").GetComponent<LunaCharacterController>();
            Quaternion newRotation;

            //if the character is facing to the right, shoot to the right
            if(lunaCharacterController.m_FacingRight)
            {
                rigidBody2D.velocity = new Vector2(speed, 0f) * Time.deltaTime;
                //rotate the fireball to face the correct direction
                newRotation = Quaternion.Euler(0,0,0);
                transform.rotation = newRotation;
            }
            //if the character id facing left, shoot to the left
            else if (!lunaCharacterController.m_FacingRight)
            {
                rigidBody2D.velocity = new Vector2(speed * -1f, 0f) * Time.deltaTime;
                newRotation = Quaternion.Euler(0,180,0);
                transform.rotation = newRotation;
            }
        }
コード例 #3
0
ファイル: LunaUserControl.cs プロジェクト: Ironhead29/luna
 private void Awake()
 {
     m_Character = GetComponent<LunaCharacterController>();
 }