示例#1
0
    public WeaponIds NextAvailableWeaponId(WeaponIds currentId)
    {
        var availableWeaponIds = new List <WeaponIds>();

        foreach (var weapon in WeaponData.Entity.HeroWeaponList)
        {
            if (weapon.IsWeaponAcquired)
            {
                availableWeaponIds.Add(weapon.WeaponID);
            }
        }

        var nextId = currentId;

        // 複数個見つかった
        if (availableWeaponIds.Count > 1)
        {
            availableWeaponIds.Sort();
            for (var index = 0; index < availableWeaponIds.Count; index++)
            {
                if (availableWeaponIds[index] == currentId)
                {
                    nextId = (index + 1 == availableWeaponIds.Count)? availableWeaponIds[0]: availableWeaponIds[index + 1];
                }
            }
        }
        return(nextId);
    }
示例#2
0
    // 投げるWeaponを切り替えるボタン
    public void ShootingModeButtonClicked()
    {
        var img      = WeaponToggleButton.GetComponent <Image>();
        var img_base = WeaponToggleButtonBase.GetComponent <Image>();

        spriteId = NextAvailableWeaponId(spriteId);
        var weapon = WeaponData.Entity.HeroWeaponList.Where(x => x.WeaponID == spriteId).First();

        img.sprite      = weapon.SelectedIcon;
        img_base.sprite = weapon.SelectedIcon;
    }
示例#3
0
    private static void UpdateCache(WeaponIds id)
    {
        var weapon = WeaponData.Entity.HeroWeaponList.Where(x => x.WeaponID == id).First();

        if (weapon == null)
        {
            return;
        }
        if (!weapon.IsWeaponAcquired)
        {
            PlayerPrefs.SetInt(weapon.Name, 1);
        }
    }
示例#4
0
    // Start is called before the first frame update
    void Start()
    {
        touch        = GameObject.Find("GameDirector").GetComponent <TouchTools>();
        gameMode     = GameObject.Find("ModeSwitcher").GetComponent <GameModeController>();
        ShootingMode = 0;
        GameDirector = GameObject.Find("GameDirector");
        var stage = GameDirector.GetComponent <GameDirector>().stage;

        if (stage == null)
        {
            stage = DataManager.currentStage;
            if (stage == null)
            {
                stage = new Stage();
            }
        }
        stage.GetRegisteredShootingWeapons(out availableWeapons); //武器管理の参照先変更により削除してもよい?
        currentWeaponId       = WeaponIds.Stone;                  // 初期値
        ShootingIntervalTimer = 0;
    }
示例#5
0
 // ウェポン獲得状況の更新
 // スコアで決まるなら、スコアをもらうだけでいい。
 // 特別な条件をフォローするために、id指定でも対応できるようにしている
 public static void UpdateWeaponAcquiredStatus(int score, WeaponIds id = WeaponIds.None)
 {
     // Stone
     if (score > 0 || id == WeaponIds.Stone)
     {
         UpdateCache(WeaponIds.Stone);
     }
     // ColaCan
     if (id == WeaponIds.ColaCan)
     {
         UpdateCache(WeaponIds.ColaCan);
     }
     // Shoes
     if (score > 7000 || id == WeaponIds.Shoes)
     {
         UpdateCache(WeaponIds.Shoes);
     }
     // Hammer
     if (score > 15000 || id == WeaponIds.Hammer)
     {
         UpdateCache(WeaponIds.Hammer);
     }
 }
示例#6
0
    public void ShootingModeButtonClicked()
    {
        var maxCount = WeaponData.Entity.HeroWeaponList.Count;

        currentWeaponId = NextAvailableWeaponId(currentWeaponId);
    }
示例#7
0
    public GameObject CreateWeapon(WeaponIds weaponId)
    {
        var lookup = WeaponLookup.Where(l => l.Weapon.Id == weaponId).Single();

        return(CreateWeapon(lookup.Prefab));
    }
示例#8
0
    public void EquipWeapon(WeaponIds id)
    {
        var weapon = Weapons.Instance.CreateWeapon(id);

        EquipWeapon(weapon);
    }
示例#9
0
 public void CreateFromExisting(GameObject weapon)
 {
     weaponObj_ = weapon;
     weapon_    = weaponObj_.GetComponent <IWeapon>();
     WeaponId   = weapon_.Id;
 }