Ejemplo n.º 1
0
    void Shooting(Vector3 position)
    {
        HeroWeaponStatus currentWeapon = WeaponData.Entity.HeroWeaponList.Where(x => x.WeaponID == currentWeaponId).First();

        if (currentWeapon == null)
        {
            currentWeapon = WeaponData.Entity.HeroWeaponList[0];
        }
        if (ShootingIntervalTimer > ShootingInterval(currentWeapon.Rapidfire))
        {
            var shootingPrefab = currentWeapon.WeaponPrefab;
            if (shootingPrefab == null)
            {
                return;
            }

            GameObject ShootingObj = Instantiate(shootingPrefab) as GameObject;
            // ウェポンのステータスをGameObjectに挿入する
            ShootingObj.AddComponent <WeaponProperties>();
            ShootingObj.GetComponent <WeaponProperties>().Initialize(currentWeapon);
            // 投げるためのForce計算
            //var mainCamera = GameObject.Find("AR Camera");
            Ray ray = Camera.main.ScreenPointToRay(position);
            ShootingObj.transform.position = ray.origin + ray.direction.normalized;
            ShootingObj.GetComponent <ShootingWatcher>().Shoot(ray.direction.normalized * ShootingForce);
            // 投げ回数のカウント
            GameDirector.GetComponent <GameDirector>().ThrowCounter += 1;
            // 投げインターバルの初期化
            ShootingIntervalTimer = 0;
        }
    }
Ejemplo n.º 2
0
    private void SetWeaponInformationToObject(HeroWeaponStatus weapon, bool isWeaponAcquired)
    {
        // ウェポン名
        var weaponName = GameObject.Find("WeaponName");

        if (weaponName != null)
        {
            weaponName.GetComponent <Text>().text = isWeaponAcquired? weapon.Name: "????";
        }
        // ウェポン画像
        var weaponImage = GameObject.Find("WeaponImage");

        if (weaponImage != null)
        {
            weaponImage.GetComponent <Image>().sprite = isWeaponAcquired? weapon.ImageOn: weapon.ImageOff;
        }
        // ウェポンの説明
        var weaponExplanation = GameObject.Find("WeaponExplanation");

        if (weaponExplanation != null)
        {
            weaponExplanation.GetComponent <Text>().text = isWeaponAcquired? weapon.Explanation: weapon.WeaponGetCondition;
        }
        // レーダーチャート
        var radarPoly = GameObject.Find("RadarPoly");

        if (radarPoly != null)
        {
            var radar = radarPoly.GetComponent <RadarChartController>();
            if (radar != null)
            {
                radar.Volumes = isWeaponAcquired?
                                new float[] {
                    (float)weapon.Attack / 5,
                    (float)weapon.Scale / 5,
                    (float)weapon.Distance / 5,
                    (float)weapon.Penetrate / 5,
                    (float)weapon.Rapidfire / 5,
                }
                                :
                new float[] { 0f, 0f, 0f, 0f, 0f };
            }
        }
        var notFound = GameObject.Find("NotAcquiredImage");

        if (notFound != null)
        {
            notFound.GetComponent <Text>().text = isWeaponAcquired? "": "?";
        }
    }
Ejemplo n.º 3
0
 // 初期化メソッド
 public void Initialize(HeroWeaponStatus src)
 {
     Attack = src.Attack;
 }