Example #1
0
    public void ShootBullets()
    {
        playerStatus.BulletConsume();

        GameObject obj  = (GameObject)Instantiate(shotGunBullet, gunPoint.position, gunPoint.rotation * Quaternion.EulerAngles(0, -Mathf.Atan2(transform.up.x, transform.up.y) + 0.2f, 0));
        GameObject obj2 = (GameObject)Instantiate(shotGunBullet, gunPoint.position, gunPoint.rotation * Quaternion.EulerAngles(0, -Mathf.Atan2(transform.up.x, transform.up.y) - 0.2f, 0));
        GameObject obj3 = (GameObject)Instantiate(shotGunBullet, gunPoint.position, gunPoint.rotation * Quaternion.EulerAngles(0, -Mathf.Atan2(transform.up.x, transform.up.y) + 0.15f, 0));
        GameObject obj4 = (GameObject)Instantiate(shotGunBullet, gunPoint.position, gunPoint.rotation * Quaternion.EulerAngles(0, -Mathf.Atan2(transform.up.x, transform.up.y) - 0.15f, 0));
        GameObject obj5 = (GameObject)Instantiate(shotGunBullet, gunPoint.position, gunPoint.rotation * Quaternion.EulerAngles(0, -Mathf.Atan2(transform.up.x, transform.up.y) + 0.1f, 0));
        GameObject obj6 = (GameObject)Instantiate(shotGunBullet, gunPoint.position, gunPoint.rotation * Quaternion.EulerAngles(0, -Mathf.Atan2(transform.up.x, transform.up.y) - 0.1f, 0));
        GameObject obj7 = (GameObject)Instantiate(shotGunBullet, gunPoint.position, gunPoint.rotation * Quaternion.EulerAngles(0, -Mathf.Atan2(transform.up.x, transform.up.y) + 0.05f, 0));
        GameObject obj8 = (GameObject)Instantiate(shotGunBullet, gunPoint.position, gunPoint.rotation * Quaternion.EulerAngles(0, -Mathf.Atan2(transform.up.x, transform.up.y) - 0.05f, 0));
        GameObject obj9 = (GameObject)Instantiate(shotGunBullet, gunPoint.position, gunPoint.rotation * Quaternion.EulerAngles(0, -Mathf.Atan2(transform.up.x, transform.up.y), 0));

        float timeToDestroy = 1.6f;

        Destroy(obj, timeToDestroy);
        Destroy(obj2, timeToDestroy);
        Destroy(obj3, timeToDestroy);
        Destroy(obj4, timeToDestroy);
        Destroy(obj5, timeToDestroy);
        Destroy(obj6, timeToDestroy);
        Destroy(obj7, timeToDestroy);
        Destroy(obj8, timeToDestroy);
        Destroy(obj9, timeToDestroy);

        weaponMusic.Fire();
    }
Example #2
0
    public void Fire()
    {
        GameObject grenade_obj = (GameObject)Instantiate(grenade, gunPoint.position, gunPoint.rotation);

        playerStatus.BulletConsume();
        weaponMusic.Fire();
        //StartCoroutine(Load());
    }
Example #3
0
    public void ShootBullets()
    {
        GameObject bullet = (GameObject)Instantiate(subGunBullet, gunPoint.position, gunPoint.rotation);

        Destroy(bullet, 2.5f);
        playerStatus.BulletConsume();
        weaponMusic.Fire();
    }
Example #4
0
    private void Update()
    {
        stateInfo = anim.GetCurrentAnimatorStateInfo(0);
        if (stateInfo.IsName("Base Layer.axe_idle"))
        {
            boxCollider.enabled = false;
        }
        //空闲状态下右手柄按下,开始蓄力
        if (stateInfo.IsName("Base Layer.axe_idle") && playerControl.CheckAttack() && !charge)
        {
            charge     = true;
            timeRecord = Time.time;

            anim.SetBool("charge", true);
            anim.SetBool("finish", false);
        }
        //蓄力状态下松开,做出攻击动作
        if (stateInfo.IsName("Base Layer.axe_charge") && !playerControl.CheckAttack() && charge)
        {
            charge              = false;
            axeAttack           = true;
            boxCollider.enabled = true;
            CalActualATK();
            playerStatus.BulletConsume();

            anim.SetBool("charge", false);
            anim.SetBool("attack", true);
            weaponMusic.Fire();
            StartCoroutine(attackFinish());
        }

        /*
         * if (stateInfo.IsName("Base Layer.axe_attack"))
         *  axeAttack = true;
         * else
         *  axeAttack = false;
         */
    }
Example #5
0
    private void Update()
    {
        stateInfo = anim.GetCurrentAnimatorStateInfo(0);

        if (stateInfo.IsName("Base Layer.saw_idle"))
        {
            damage = false;
        }

        if (stateInfo.IsName("Base Layer.saw_idle") && playerControl.CheckAttack())
        {
            attack = true;

            anim.SetBool("attack", true);
            anim.SetBool("idle", false);
            weaponMusic.Fire();
        }
        if (stateInfo.IsName("Base Layer.saw_attack") && !playerControl.CheckAttack())
        {
            attack = false;
            anim.SetBool("attack", false);
            anim.SetBool("idle", true);
            weaponMusic.StopFire();
        }

        if (Time.time > timeRecord + intervalAttackTime && attack)
        {
            timeRecord = Time.time;
            damage     = true;
            //damage = !damage;
        }
        else
        {
            damage = false;
        }
    }