private void StealItem(BattleEnemy enemy, Int32 itemIndex) { Byte itemId = enemy.StealableItems[itemIndex]; if (itemId == Byte.MaxValue) { UiState.SetBattleFollowFormatMessage(BattleMesages.CouldNotStealAnything); return; } enemy.StealableItems[itemIndex] = Byte.MaxValue; GameState.Thefts++; BattleItem.AddToInventory(itemId); UiState.SetBattleFollowFormatMessage(BattleMesages.Stole, FF9TextTool.ItemName(itemId)); if (_v.Caster.HasSupportAbility(SupportAbility2.Mug)) { _v.Target.Flags |= CalcFlag.HpAlteration; _v.Target.HpDamage = (Int16)(GameRandom.Next16() % (_v.Caster.Level * _v.Target.Level >> 1)); } if (_v.Caster.HasSupportAbility(SupportAbility1.StealGil)) { GameState.Gil += (UInt32)(GameRandom.Next16() % (1 + _v.Caster.Level * _v.Target.Level / 4)); } }
public void CheckReference(BattlePlayer player, BattleEnemy enemy) { if (player != null && _player != player) { _player = player; if (Settings.RecordPlayerCard) { _hasMulligan = false; _hasPlayerDrawn = false; _player.OnAddHandCardEvent += Player_OnAddHandCardEvent; _player.OnAddPlayCardEvent += Player_OnAddPlayCardEvent; _player.OnAddBanishEvent += Player_OnAddBanishEvent; _player.OnAddCemeteryEvent += Player_OnAddCemeteryEvent; } if (Settings.ShowCountdown) { _player.OnPlayerActive += Player_OnPlayerActive; _player.OnSendTurnEnd += Player_OnSendTurnEnd; } } if (enemy != null && _enemy != enemy && Settings.RecordEnemyCard) { _enemy = enemy; _enemy.OnAddDeckEvent += Enemy_OnAddDeckEvent; _enemy.OnAddHandCardEvent += Enemy_OnAddHandCardEvent; _enemy.OnAddPlayCardEvent += Enemy_OnAddPlayCardEvent; _enemy.OnSpellPlayEvent += Enemy_OnSpellPlayEvent; } }
private BattleEnemy DrawBattleEnemy(Rect position, BattleEnemy current) { if (current == null) { current = new BattleEnemy(); } EditorGUI.TextField(new Rect(position.x, position.y, 200, position.height), current.Data.ActorName); if (GUI.Button(new Rect(position.x + 200, position.y, 60, position.height), "Select")) { var window = EditorWindow.GetWindow <EnemyUI>(); window.Selected = true; window.Initialize(ref current.Data); window.Show(); } float maxX = current.Data.Image != null ? (Constant.BackgroundWidth / 2) - current.Data.Image.textureRect.width : Constant.BackgroundWidth / 2; float maxY = current.Data.Image != null ? (Constant.BackgroundHeight / 2) - current.Data.Image.textureRect.height : Constant.BackgroundHeight / 2; EditorGUI.LabelField(new Rect(position.x + 280, position.y, 20, position.height), "X: "); current.EnemyPosition.x = EditorGUI.Slider(new Rect(position.x + 300, position.y, 200, position.height), current.EnemyPosition.x, -Constant.BackgroundWidth / 2, maxX); EditorGUI.LabelField(new Rect(position.x + 520, position.y, 20, position.height), "Y: "); current.EnemyPosition.y = EditorGUI.Slider(new Rect(position.x + 540, position.y, 200, position.height), current.EnemyPosition.y, -maxY, (Constant.BackgroundHeight / 2)); return(current); }
/// <summary> /// Raycasts from mouse /// </summary> /// <returns>The tile</returns> private GameObject MouseRaycast(List <Node> movementRange) { Ray ray = raycastCamera.ScreenPointToRay(Input.mousePosition); Vector3 rayDirection = Input.mousePosition - raycastCamera.transform.position; //Ray ray = new Ray(raycastCamera.transform.position, rayDirection); RaycastHit hit; Physics.Raycast(ray, out hit, Mathf.Infinity); if (hit.collider != null && !EventSystem.current.IsPointerOverGameObject()) { Tile tile = hit.collider.gameObject.GetComponent <Tile>(); BattleEnemy enemy = hit.collider.gameObject.GetComponent <BattleEnemy>(); //For movement if (tile != null && !Attacking && movementRange.Contains(GetTargetNode(tile))) { return(hit.collider.gameObject); } //For attacking else if (enemy != null && Pathfinding.GetRange(Nodes, friendlies[0].nodeParent, lastSelectedAttack.Range).Contains(enemy.nodeParent)) { return(hit.collider.gameObject); } } return(null); }
public void CreatePhysics() { var w = new World(); var obj = new BattleEnemy(); obj.CreatePhysics(w); Assert.AreEqual(1, w.BodyList.Count); }
void Start() { if (isAttackGen) { battleEnemy = FindObjectOfType <BattleEnemy>(); } objectCounter = 0; }
// Update is called once per frame void Update() { if (bc.enemyBattleStart != null) { name = bc.enemyBattleStart.name; bc.enemyBattleStart.gameObject.SetActive(false); } if (enemyHealth == null) { enemyHealth = FindObjectOfType <BattleEnemy>(); expToGive = enemyHealth.expToGive; } // healthBar.maxValue = playerHealth.playerMaxHealth; // healthBar.value = playerHealth.playerCurrentHealth; // HPText.text = "HP: "+playerHealth.playerCurrentHealth+" / "+playerHealth.playerMaxHealth; // expBar.maxValue = playerStats.toLevelUp[playerStats.currentLevel]; // expBar.value = playerStats.currentExp; // EXPText.text = "EXP: "+playerStats.currentExp+" / "+playerStats.toLevelUp[playerStats.currentLevel]; // LVLText.text= "LVL: "+playerStats.currentLevel; enemyHealthBar.maxValue = enemyHealth.maxHP; enemyHealthBar.value = enemyHealth.HP; if (FindObjectOfType <UIManager>() != null) { if (FindObjectOfType <UIManager>().invActive) { enemyHealthBar.gameObject.SetActive(false); } else { enemyHealthBar.gameObject.SetActive(true); } } else { enemyHealthBar.gameObject.SetActive(true); } if (enemyHealthBar.value <= 0) { endBattle(expToGive); // FindObjectOfType<PlayerController>().EnemyDestroyer.SetActive(true); } else if (FindObjectOfType <ShipPlayerController>().GetComponent <PlayerHealthManager>().playerCurrentHealth <= 0) { endBattleLoss(); } }
void Start() { sfxMan = FindObjectOfType <SFXManager>(); rb = GetComponent <Rigidbody2D>(); SS = FindObjectOfType <ShotShooter>(); rb.velocity = new Vector3(Random.Range(SS.lowSpeed, SS.highSpeed), 0, 0); battleEnemy = FindObjectOfType <BattleEnemy>(); }
// Update is called once per frame void Update() { if (battleEnemy == null) { battleEnemy = FindObjectOfType <BattleEnemy>(); enemyName.text = FindObjectOfType <BattleEnemy>().enemyName; // FindObjectOfType<MusicController>().switchTrack(battleEnemy.song); } }
/// <summary> /// Creates a new BattleEnemy and gives it its data /// </summary> /// <param name="name">Name as EnemyName</param> /// <returns></returns> public static BattleEnemy MakeNewBattleEnemy(EnemyName name) { // Create data BattleEnemy orig = Data[name]; // Create enemy using data BattleEnemy newEnemy = new BattleEnemy(name, orig.Stats); newEnemy.HealAll(); return(newEnemy); }
// Use this for initialization void Start() { members = new List <BattleEnemy>(); //手动添加敌人 BattleEnemy be1 = new BattleEnemy(); be1.Setup(120, 12, 3); be1.SetBattleTex("Assassin.png"); members.Add(be1); }
public void changeOption() { if (isAttackGen && battleEnemy == null) { battleEnemy = FindObjectOfType <BattleEnemy>(); } System.Random random = new System.Random(); currentOption = random.Next(0, battleEnemy.attacks.Length); }
void Start() { bEnemy = FindObjectOfType <BattleEnemy>(); //EnemyGameObject=Enemy.BattleEnemy; // bEnemy=EnemyGameObject.GetComponent<BattleEnemy>(); spawnTime = bEnemy.spawnTime; spawnCount = bEnemy.spawnCount; lowSpeed = bEnemy.lowSpeed; highSpeed = bEnemy.highSpeed; spawnCounter = 0; }
public void DestroyPhysics(int count) { var w = new World(); for (var i = 0; i < count; i++) { var obj = new BattleEnemy(); obj.CreatePhysics(w); PhysicsBodyRemover.Add(obj.Body, obj.Fixtures); } w.StepWithDelete(0.1f, 1, 1); Assert.AreEqual(0, w.BodyList.Count); }
private void DrawEnemy(BattleEnemy obj) { if (obj != null) { if (obj.Data.Image != null) { GUI.DrawTextureWithTexCoords(new Rect(obj.EnemyPosition.x + previewX, -obj.EnemyPosition.y + previewY, obj.Data.Image.textureRect.width, obj.Data.Image.textureRect.height), obj.Data.Image.texture, Constant.GetTextureCoordinate(obj.Data.Image) ); } } }
void Start() { battleEnemy = FindObjectOfType <BattleEnemy>(); Enemy = FindObjectOfType <EnemyBattleStart>(); EnemyGameObject = Enemy.BattleEnemy; enemyBattleStart = FindObjectOfType <EnemyBattleStart>().gameObject; //Destroy(enemyBattleStart); EnemyGameObject.SetActive(true); Instantiate(EnemyGameObject, new Vector3(6f, -2.5f, 0f), Quaternion.identity); enemyBattleStart = FindObjectOfType <EnemyBattleStart>().gameObject; }
private static Boolean HasStealableItems(BattleEnemy enemy) { Boolean hasStealableItems = false; for (Int16 index = 0; index < 4; ++index) { if (enemy.StealableItems[index] != Byte.MaxValue) { hasStealableItems = true; } } return(hasStealableItems); }
/* * 初期化 * プレイヤーと敵を生成 * カメラの設定 * 後々テーブルで敵の数などを決めれるようにする */ void Start() { // プレイヤーの生成 player = Instantiate(playerPrefab, new Vector3(PLAYER_POSITION, 0.0f, 0.0f), Quaternion.Euler(0, 90, 0)) as BattlePlayer; PlayerStatesData stateData = GlobalDataManager.GetGlobalData().LoadPlayerStatesData(); if (stateData == null) { player.STATES = GlobalDataManager.GetGlobalData().GetDataBase().GetPlayerStates(1); player.HP = player.STATES.HP; } else { player.STATES = GlobalDataManager.GetGlobalData().GetDataBase().GetPlayerStates(stateData.LV); player.STATES.HP = stateData.HP; player.HP = stateData.HP; player.STATES.MP = stateData.MP; player.STATES.EXP = stateData.EXP; } canvasManager.CreateStatesUI(player, true); // エネミーの生成 EnemyTable table = GlobalDataManager.GetGlobalData().GetEnemyTable().GetEnemyTable((int)Table.LEVEL.EASY); int enemy_num = table.NUM; for (int i = 0; i < enemy_num; i++) { BattleEnemy enemy = Instantiate(enemyPrefab, new Vector3((i * 0.3f) + 0.3f, 0.0f, 0.0f), Quaternion.Euler(0, 270, 0)) as BattleEnemy; enemy.STATES = GlobalDataManager.GetGlobalData().GetDataBase().GetSkeletonStates(table.LEVEL); enemy.HP = enemy.STATES.HP; enemy.Manager = this; enemy.Player = player; enemy.ID = i; enemyList.Add(enemy); //canvasManager.CreateStatesUI(enemy); targetList.Add(i); } player.Manager = this; player.Enemy = enemyList[player.TargetID]; // カメラ位置の設定 centerPoint.Player = player.transform; centerPoint.TargetEnemy = enemyList[player.TargetID].transform; // ターゲットポインター targetPointer = Instantiate(targetPointerPrefab); targetPointer.Target = player.Enemy; StartCoroutine(GameStart()); }
private void initEnemy(int enemy_id) { if (m_BattleDispEnemy != null && m_MasterDataParamEnemys != null) { //MasterDataParamEnemy enemy_master = searchEnemy(enemy_id); int index = searchEnemyIndex(enemy_id); MasterDataParamEnemy enemy_master = m_MasterDataParamEnemys[index]; if (enemy_master != null) { MasterDataParamChara chara_master = MasterFinder <MasterDataParamChara> .Instance.Find((int)enemy_master.chara_id); if (chara_master != null) { MasterDataParamEnemy wrk_enemy_master = new MasterDataParamEnemy(); wrk_enemy_master.Copy(enemy_master); //元のマスターデータに影響が出ないようにコピーを作成 BattleEnemy battle_enemy = null; { battle_enemy = new BattleEnemy(); battle_enemy.setMasterData(wrk_enemy_master, chara_master); battle_enemy.m_EnemyAttack = enemy_master.status_pow; battle_enemy.m_EnemyDefense = enemy_master.status_def; battle_enemy.m_EnemyHP = enemy_master.status_hp; battle_enemy.m_EnemyHPMax = enemy_master.status_hp; battle_enemy.m_EnemyDrop = 0; battle_enemy.m_StatusAilmentChara = new StatusAilmentChara(StatusAilmentChara.OwnerType.ENEMY); battle_enemy.setAcquireDropUnit(false); } m_CurrentBattleEnemy = battle_enemy; m_CurrentEnemyDispInfo = m_EnemyDispInfos[index]; setInfoToInteface(); setInfoToWorkMaster(); m_BattleEnemys = new BattleEnemy[1]; m_BattleEnemys[0] = battle_enemy; m_BattleDispEnemy.instanceObject(m_BattleEnemys); m_BattleDispEnemy.gameObject.SetLayerRecursively(LayerMask.NameToLayer("BATTLE")); // レイヤーを設定し直し m_BattleDispEnemy.showTargetCursor(0); // ターゲットカーソルを表示 } } else { m_BattleDispEnemy.instanceObject(null); } } }
/* * ターゲットしている敵に攻撃 */ public void PlayerAttackEnemy(int atk, BattleEnemy enemy) { enemy.Damage(atk);// とりあえず1 if (enemy.IsDead()) { totalEXP += enemy.STATES.EXP; for (int i = 0; i < targetList.Count; i++) { if (enemy.ID == targetList[i]) { targetList.RemoveAt(i); } } ChangeTargetEnemy(); } }
public static BattleEnemy ReadBattleEnemy(object id, List <Enemy> enemiesData, List <PassiveSkill> pSkillsData) { BattleEnemy battleEnemy; using (var conn0 = Connect()) { conn0.Open(); using (var data0 = Read(conn0, "SELECT * FROM BattleEnemy WHERE BattleEnemy_ID = " + id)) { data0.Read(); battleEnemy = new BattleEnemy(data0, enemiesData, pSkillsData); } conn0.Close(); } return(battleEnemy); }
private IEnumerator Starting() { //Setup enemy BattleEnemy battleEnemyPrefab = Array.Find(enemyPrefabs, data => data.id == DataManager.Instance.battleEnemyData.id); currentEnemy = Instantiate(battleEnemyPrefab, spawnPos.position, spawnPos.rotation); currentEnemy.enemyData = DataManager.Instance.battleEnemyData; enemyNameText.text = currentEnemy.enemyData.name; //Setup player player.hp = DataManager.Instance.playerHP; yield return(new WaitForSeconds(8)); enemyHPIndicator.characterData = currentEnemy.enemyData; enemyHPIndicator.gameObject.SetActive(true); hpIndicator.gameObject.SetActive(true); }
private void OnEntityDeath(BattleEntity entity) { BattleEnemy enemy = entity as BattleEnemy; if (enemy != null) { enemies.Remove(enemy); } else { friendlies.Remove(entity); } Destroy(entity.gameObject); BattleStatus status = CheckBattleStatus(); ProcessBattleStatus(status); }
public BattleEnemyGroup(Summary1 s1) { set1(s1); for (int t1 = 0; t1 < max(); t1++) { battle_enemy[t1] = new BattleEnemy(s1, t1); } { image_save_enemy = new ImageSaveEnemy(s1); image_save_enemy.init1(); } battle_enemy_appear_control = new BattleEnemyAppearControl(s1); battle_enemy_ai = new BattleEnemyAI(s1); }
public static void outputEnemyParty(BattleEnemy[] enemy_party) { for (int idx_enemy = 0; idx_enemy < enemy_party.Length; idx_enemy++) { BattleEnemy battle_enemy = enemy_party[idx_enemy]; DebugBattleLog.writeText(DebugBattleLog.StrOpe + "敵情報(" + idx_enemy.ToString() + ")" + " EnemyFixID:" + battle_enemy.getMasterDataParamEnemy().fix_id.ToString() + " CharaFixID:" + battle_enemy.getMasterDataParamChara().fix_id.ToString() + " 属性:" + battle_enemy.getMasterDataParamChara().element.ToString() + " 種族1:" + battle_enemy.getMasterDataParamChara().kind.ToString() + " 種族2:" + battle_enemy.getMasterDataParamChara().sub_kind.ToString() + " [" + battle_enemy.getMasterDataParamChara().name + "]" ); uint[] enemy_abilitys = battle_enemy.getEnemyAbilitys(); for (int idx_ability = 0; idx_ability < enemy_abilitys.Length; idx_ability++) { uint ability_fix_id = enemy_abilitys[idx_ability]; if (ability_fix_id != 0) { string ability_name = ""; MasterDataEnemyAbility ability_master = BattleParam.m_MasterDataCache.useEnemyAbility(ability_fix_id); if (ability_master != null) { ability_name = ability_master.name; } DebugBattleLog.writeText(DebugBattleLog.StrOpe + " 特性" + (idx_ability + 1).ToString() + "(FixId:" + ability_fix_id.ToString() + "):" + ability_name ); } } DebugBattleLog.writeText(DebugBattleLog.StrOpe + " " + " HP:" + battle_enemy.m_EnemyHP.ToString() + "/" + battle_enemy.m_EnemyHPMax.ToString() + " SkillTurn:" + battle_enemy.m_EnemyTurn.ToString() + "/" + battle_enemy.m_EnemyTurnMax.ToString() ); // 状態変化 StatusAilmentChara ailment = battle_enemy.m_StatusAilmentChara; outputAilment(ailment); } }
private void changeEnemySelection(GameObject cursor, Vector3[] positionArr, BattleState stateToChangeTo) { /// THIS FUNCTION IS FOR CHANGING THE POSITION OF THE CURSOR THAT SELECTS THE ENEMY TO ATTACK... /// THE CURSOR IS JUST FOR SHOW, BUT THE UP AND DOWN ARROWS CHANGE THE ACTION THAT IS SELECTED. /// MOVE CURSOR UP OR DOWN ////// if (Input.GetKeyUp(KeyCode.UpArrow)) { buttonSelectIndex--; if (buttonSelectIndex < 0) { buttonSelectIndex = positionArr.Length - 1; } cursor.transform.position = positionArr[buttonSelectIndex]; } else if (Input.GetKeyUp(KeyCode.DownArrow)) { buttonSelectIndex++; if (buttonSelectIndex == positionArr.Length) { buttonSelectIndex = 0; } cursor.transform.position = positionArr[buttonSelectIndex]; } //////////////////////////////////////////////////////// // ONCE ENTER IS PRESSED THE CURSOR WILL BE DESTROYED // // AND THE ENEMY WILL BE SELECTED // //////////////////////////////////////////////////////// else if (Input.GetKeyUp(KeyCode.Return)) { state = stateToChangeTo; enemyChosen = enemy.GetComponent <SpanEnemies>().getEnemy(buttonSelectIndex); enemyChosen_properties = enemyChosen.GetComponent <BattleEnemy>(); travel_to = enemyChosen.transform.position; travel_to = new Vector3(travel_to.x, travel_to.y + 2.5f); enemyChosenIndex = buttonSelectIndex; buttonSelectIndex = 0; Destroy(cursor); Destroy(abilityList); } ///////////////////////////////////////////////////////// }
public void CheckReference(BattlePlayer player, BattleEnemy enemy) { if (player != null && _player != player) { _player = player; _hasMulligan = false; _hasPlayerDrawn = false; _player.OnAddHandCardEvent += Player_OnAddHandCardEvent; _player.OnAddPlayCardEvent += Player_OnAddPlayCardEvent; } if (enemy != null && _enemy != enemy) { _enemy = enemy; _enemy.OnAddHandCardEvent += Enemy_OnAddHandCardEvent; _enemy.OnAddPlayCardEvent += Enemy_OnAddPlayCardEvent; _enemy.OnSpellPlayEvent += Enemy_OnSpellPlayEvent; } }
public void Initialize(System.Data.SQLite.SQLiteDataReader data, List <Environment> environmentsData, List <Enemy> enemiesData, List <PassiveSkill> pSkillsData, List <Skill> skillsData, List <Item> itemsData, List <Weapon> weaponsData, List <State> statesData) { Initialize(data); int numberOfEnemies = Int(data["NumberOfEnemies"]); for (int i = 1; i <= numberOfEnemies; i++) { object beId = data["BattleEnemy" + i]; BattleEnemy b = ReadBattleEnemy(beId, enemiesData, pSkillsData); Enemy enemyInBattle = b.Enemy; enemyInBattle.SetAllStats(b.Level, b.HPMultiplier); enemyInBattle.MoveToPosition(b.GridPositionZ, b.GridPositionX); if (b.PassiveSkill1 != null) { enemyInBattle.AddPassiveSkill(pSkillsData, b.PassiveSkill1.Id); } if (b.PassiveSkill2 != null) { enemyInBattle.AddPassiveSkill(pSkillsData, b.PassiveSkill2.Id); } List <EnemyTool <Skill> > enemySkills = ReadEnemyTools(beId, skillsData, statesData); List <EnemyTool <Item> > enemyItems = ReadEnemyTools(beId, itemsData, statesData); List <EnemyTool <Weapon> > enemyWeapons = ReadEnemyTools(beId, weaponsData, statesData); foreach (var et in enemySkills) { enemyInBattle.AddSkill(skillsData, et.Tool.Id); } foreach (var et in enemyItems) { enemyInBattle.AddItem(itemsData, et.Tool.Id); } foreach (var et in enemyWeapons) { enemyInBattle.AddWeapon(weaponsData, et.Tool.Id); } enemyInBattle.MaxHPSP(); Enemies.Add(enemyInBattle); } }
public static void cacheBattleUnitTexture() { if (BattleParam.m_PlayerParty != null) { CharaOnce[] player_party_members = BattleParam.m_PlayerParty.getPartyMembers(CharaParty.CharaCondition.EXIST); for (int idx = 0; idx < player_party_members.Length; idx++) { CharaOnce player_party_member = player_party_members[idx]; BattleUnitTextureCache.Instance.loadTexture((int)player_party_member.m_CharaMasterDataParam.fix_id, false); if (player_party_member.m_LinkParam != null && player_party_member.m_LinkParam.m_cCharaMasterDataParam != null ) { BattleUnitTextureCache.Instance.loadTexture((int)player_party_member.m_LinkParam.m_cCharaMasterDataParam.fix_id, false); } } } if (BattleParam.m_EnemyParam != null) { for (int idx = 0; idx < BattleParam.m_EnemyParam.Length; idx++) { BattleEnemy battle_enemy = BattleParam.m_EnemyParam[idx]; if (battle_enemy != null) { MasterDataParamChara enemy_chara = battle_enemy.getMasterDataParamChara(); if (enemy_chara != null) { BattleUnitTextureCache.Instance.loadTexture((int)enemy_chara.fix_id, false); } } } } // 主人公の画像をキャッシュ int current_hero_id = (int)MasterDataUtil.GetCurrentHeroID(); BattleUnitTextureCache.Instance.loadTexture(-current_hero_id, false); }
public void Perform() { BattleEnemy enemy = BattleEnemy.Find(_v.Target); if (!HasStealableItems(enemy)) { UiState.SetBattleFollowFormatMessage(BattleMesages.DoesNotHaveAnything); return; } if (!_v.Caster.HasSupportAbility(SupportAbility2.Bandit)) { _v.Context.HitRate = (Int16)(_v.Caster.Level + _v.Caster.Will); _v.Context.Evade = _v.Target.Level; if (GameRandom.Next16() % _v.Context.HitRate < GameRandom.Next16() % _v.Context.Evade) { UiState.SetBattleFollowFormatMessage(BattleMesages.CouldNotStealAnything); return; } } if (enemy.StealableItems[3] != Byte.MaxValue) { StealItem(enemy, 3); } else if (enemy.StealableItems[2] != Byte.MaxValue) { StealItem(enemy, 2); } else if (enemy.StealableItems[1] != Byte.MaxValue) { StealItem(enemy, 1); } else { StealItem(enemy, 0); } }