示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        hp = hp_max;
        mp = mp_max;

        magic_object = Instantiate(magic_prefab) as GameObject;
        magic_script = magic_object.GetComponent <MagicBase>();

        ui = GetComponent <PlayerUI>();

        //scoreとUIの初期化
        score = 0;

        ui.SetScore(score);

        //distanceとUIの初期化
        distance = 100000;

        ui.SetDistance(distance);

        ui.SetUIData(hp_max, mp_max);

        p_anim = gameObject.GetComponent <PlayerAnimator>();

        scenechange = 0;
        timecount   = 2f;
        cam         = GameObject.Find("Main Camera");
        camSprite   = cam.GetComponent <CameraControll>();
    }
示例#2
0
 public void MyGame()
 {
     player.typeSelection();
     player.NameFunction();
     MagicBase.pickPower();
     weapon.GetListOfWeapons();
     Play();
 }
示例#3
0
    public void SetSpecialMagic(GameObject bullet)
    {
        this.special_magic_object = bullet;
        this.special_magic_script = bullet.GetComponent <MagicBase>();

        this.special_magic_script.UseNum = 0;

        ui.SetSpecailBulletInfo(special_magic_script.Type, special_magic_script.UseLimit);
    }
示例#4
0
    public void ShootGun()
    {
        if (curWeapon == Weapons.Pistol)
        {
            //StartCoroutine(playerShooting(origTBS));

            if (timeBetweenShots <= 0 && currentAmmo > 0)
            {
                currentAmmo--;
                MagicBase newMagic = Instantiate(magic, firePoint.position, firePoint.rotation) as MagicBase;
                SoundManager.instance.PlaySingle(pistolSound);
                //audioSource.Play();
                isShooting        = true;
                timeBetweenShots += origTBS;
            }/*
              * else if(currentAmmo <= 0)
              * {
              * StartCoroutine(Reloading(reloadTime));
              * }*/
        }
        else if (curWeapon == Weapons.Shotgun)
        {
            //StartCoroutine(playerShooting(origTBS));

            if (timeBetweenShots <= 0 && currentAmmo > 0)
            {
                currentAmmo--;
                MagicBase newMagic   = Instantiate(shotgunBullet, firePoint.position, firePoint.rotation) as MagicBase;
                MagicBase newBullet  = Instantiate(shotgunBullet, firePoint01.position, firePoint01.rotation) as MagicBase;
                MagicBase newBullet2 = Instantiate(shotgunBullet, firePoint02.position, firePoint02.rotation) as MagicBase;
                SoundManager.instance.PlaySingle(shotgunSound);
                //audioSource.Play();
                isShooting        = true;
                timeBetweenShots += origTBS;
            }/*
              * else if (currentAmmo <= 0)
              * {
              * StartCoroutine(Reloading(reloadTime));
              * }*/
        }
        else if (curWeapon == Weapons.Icegun)
        {
            //StartCoroutine(playerShooting(origTBS));

            if (timeBetweenShots <= 0 && currentAmmo > 0)
            {
                currentAmmo--;
                MagicBase newMagic = Instantiate(IceBullet, firePoint.position, firePoint.rotation) as MagicBase;
                SoundManager.instance.PlaySingle(icegunSound);
                //audioSource.Play();
                isShooting        = true;
                timeBetweenShots += origTBS;
            }
        }

        //Debug.Log("Shooting weapon with " + magic.magicDamage);
    }
示例#5
0
    public void CheckEraceSpecialBullet()
    {
        if (!this.special_magic_script.IsUseable())
        {
            this.special_magic_script = null;
            this.special_magic_object = null;

            ui.SetSpecailBulletInfo(MagicBase.MagicType.NORMAL, 0);
        }
    }
示例#6
0
 public void Shoot()
 {
     if (timeBetweenShots <= 0)
     {
         MagicBase newMagic = Instantiate(magic, firePoint.position, firePoint.rotation) as MagicBase;
         newMagic.speed = magicSpeed;
         //play audio source
         timeBetweenShots = origTBS;
     }
 }
示例#7
0
    /// <summary>
    /// 通常弾を発射する処理
    /// </summary>
    /// <param name="position">発射時の目標地点</param>
    public void Beam(Vector3 position)
    {
        MagicBase script = player.MagicScript;

        if (player.Mp <= 0)
        {
            return;
        }

        if (!script.gameObject.activeSelf)
        {
            if (transform.position.x > position.x)
            {
                script.gameObject.transform.position = transform.position - transform.right * 0.5f - transform.forward * 0.5f;

                script.MoveStart(position);

                player.PlusMp(-script.Cost);
            }
        }
    }
示例#8
0
    /// <summary>
    /// 特殊弾を発射するスクリプト
    /// </summary>
    /// <param name="position">発射時の目標地点</param>
    public void SpecialBeam(Vector3 position)
    {
        MagicBase script = player.SpecialMagicScript;

        if (script != null)
        {
            if (script.IsUseable() && !script.gameObject.activeSelf)
            {
                if (transform.position.x > position.x)
                {
                    script.gameObject.transform.position = transform.position - transform.right * 0.5f - transform.forward * 0.5f;

                    script.MoveStart(position);

                    script.UseNum++;

                    player.MessageUseSpecialBullet();

                    player.CheckEraceSpecialBullet();
                }
            }
        }
    }