コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        /*
         * for(int i = 0; i < keyCodes.Length; i++)
         * {
         *  if (Input.GetKeyDown(keyCodes[i]))
         *      skills[i].Activate();
         *  i = keyCodes.Length;
         * }*/

        if (Input.GetKeyDown(KeyCode.Space))
        {
            key2skill[KeyCode.Space].Activate(new Vector3(Mathf.Cos(Mathf.Deg2Rad * (transform.rotation.eulerAngles.z + offsetAngle)), Mathf.Sin(Mathf.Deg2Rad * (transform.rotation.eulerAngles.z + offsetAngle)), 0f));
            skillUI.skillCooldown();
        }
        else if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            key2skill[KeyCode.LeftShift].Activate(new Vector3(Mathf.Cos(Mathf.Deg2Rad * (transform.rotation.eulerAngles.z + offsetAngle)), Mathf.Sin(Mathf.Deg2Rad * (transform.rotation.eulerAngles.z + offsetAngle)), 0f));
            skillUI.skillCooldown();
        }
        else if (Input.GetKeyDown(KeyCode.E))
        {
            key2skill[KeyCode.E].Activate(new Vector3(Mathf.Cos(Mathf.Deg2Rad * (transform.rotation.eulerAngles.z + offsetAngle)), Mathf.Sin(Mathf.Deg2Rad * (transform.rotation.eulerAngles.z + offsetAngle)), 0f));
            skillUI.skillCooldown();
        }
        aimDirection = new Vector3(Input.GetAxisRaw("FireHorizontal"), Input.GetAxisRaw("FireVertical"), 0f);

        if (aimDirection != Vector3.zero)
        {
            basicAttackSkill.Activate(aimDirection);
        }
    }