コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        healthBar.SetHealth((int)health);

        if (Input.GetKeyDown(KeyCode.Q) && ability_push_isActive)
        {
            abilty_pushforce.AbilityForce();
        }

        if (Input.GetKeyDown(KeyCode.Alpha1) && ability_thunder_isActive)
        {
            Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out RaycastHit hit, thunder_range);
            Instantiate(thunder_particles, hit.point, Quaternion.LookRotation(hit.normal));
        }

        if (Input.GetKeyDown(KeyCode.F) && ability_barrel_isActive)
        {
            Vector3    playerPos       = transform.position;
            Vector3    playerDirection = transform.forward;
            Quaternion playerRotation  = transform.rotation;
            Vector3    spawnPos        = playerPos + playerDirection * spawnDistance;
            Instantiate(barrel_tospawn, spawnPos, playerRotation);
        }

        if (Input.GetKeyDown(KeyCode.E) && ability_slowmo_isActive)
        {
            abilty_slowmotion.DoSlowMotion();
        }
    }