コード例 #1
0
ファイル: ShotGun.cs プロジェクト: J0ke1fdr/Animal-Attack
    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();
    }
コード例 #2
0
ファイル: Rocket.cs プロジェクト: J0ke1fdr/Animal-Attack
    public void Fire()
    {
        GameObject grenade_obj = (GameObject)Instantiate(grenade, gunPoint.position, gunPoint.rotation);

        playerStatus.BulletConsume();
        weaponMusic.Fire();
        //StartCoroutine(Load());
    }
コード例 #3
0
ファイル: SubGun.cs プロジェクト: J0ke1fdr/Animal-Attack
    public void ShootBullets()
    {
        GameObject bullet = (GameObject)Instantiate(subGunBullet, gunPoint.position, gunPoint.rotation);

        Destroy(bullet, 2.5f);
        playerStatus.BulletConsume();
        weaponMusic.Fire();
    }
コード例 #4
0
    private void OnTriggerStay(Collider col)
    {
        if (col.tag == "Enemy" && damage)
        {
            playerStatus.BulletConsume();
            Debug.Log("damage at " + Time.time);
            col.gameObject.SendMessage("ApplyDamage", basicATK);
        }

        if (col.tag == "Prop" && damage)
        {
            col.gameObject.SendMessage("ApplyDamage", basicATK);
        }
    }
コード例 #5
0
ファイル: Axe.cs プロジェクト: J0ke1fdr/Animal-Attack
    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;
         */
    }