//---------------------------アイテム使うときの処理------------------------------------------------------- public override void ButtonEvent(int bID) { this.gameObject.SetActive(false); GameObject o = Instantiate(Resources.Load("Prefabs/UIPrefabs/Target_select", typeof(GameObject)) as GameObject) as GameObject; selected = o.GetComponent <TargetSelect> (); selected.Prepare(status, this, status.itemList[cursor.nowNumber].id == 4); }
// Use this for initialization void Start() { buda_joystick1 = GameObject.Find("buda_joystick1").GetComponent <SpriteRenderer>(); buda_keyboard1 = GameObject.Find("buda_keyboard1").GetComponent <SpriteRenderer>(); haka_joystick1 = GameObject.Find("haka_joystick1").GetComponent <SpriteRenderer>(); haka_keyboard1 = GameObject.Find("haka_keyboard1").GetComponent <SpriteRenderer>(); budaHands = GameObject.Find("budaHand"); hakaHands = GameObject.Find("hakaHand"); budaHands.SetActive(false); hakaHands.SetActive(false); TargetSelectScript = transform.GetComponent <TargetSelect>(); selectStage = GameObject.Find("SelectStage").GetComponent <SelectStage>(); }
private void buttonSelectPath_Click(object sender, EventArgs e) { if (TSbtnMode) { TargetSelect.ShowDialog(); btnSelectPath.Text = "Press again to load modlist"; TSbtnMode = false; btnLaunch.Enabled = false; } else { UpdateTargetPath(TargetSelect.SelectedPath); btnSelectPath.Text = "Select path"; TSbtnMode = true; } }
public static string GetDescOfTargetSelector(TargetRange targetRange, TargetSelect targetSelect, int choiceCount) { string textKey = "TargetRange_" + targetSelect + "_" + targetRange; string rawDesc = ""; rawDesc = LanguageManager_Common.GetText(textKey); if (rawDesc != null && rawDesc.Contains("{0}")) { if (targetSelect == TargetSelect.Multiple || targetSelect == TargetSelect.MultipleRandom) { rawDesc = string.Format(rawDesc, choiceCount); } } return(rawDesc); }
public virtual void Update(GameTime Gametime, List<Emeny> enemiesAlive) { ActiveEnemies = enemiesAlive; KeyboardState keystate = Keyboard.GetState(); Inrange(); GetTarget(); Shooting(BulletTexture); if (keystate.IsKeyUp(Keys.NumPad1)) { Currenttarget = TargetSelect.mosthp; } if (keystate.IsKeyUp(Keys.NumPad2)) { Currenttarget = TargetSelect.leasthp; } }
public void switchLane() { if (isServer) { ComputerLane newLane = computerLane == ComputerLane.LEFT ? ComputerLane.RIGHT : ComputerLane.LEFT; gameObject.GetComponent<Attack>().initiliseAttack(); targetSelect = GetComponent<TargetSelect> (); Vector3 desiredPosition = transform.position; desiredPosition.z = newLane == ComputerLane.LEFT ? 210f : 90f; //work out the x if the screen we're switching on is not 0 and the number of screens in each lane is not the same int currentScreen = (int)transform.position.x / 100; if(currentScreen > 0 && GraniteNetworkManager.numberOfScreens_left != GraniteNetworkManager.numberOfScreens_right) { desiredPosition.x = (transform.position.x % 100) + ((newLane == ComputerLane.LEFT ? GraniteNetworkManager.numberOfScreens_left : GraniteNetworkManager.numberOfScreens_right) - 1) * 100; } gameObject.GetComponent<HeroMovement>().initialiseMovement(desiredPosition); targetSelect.InitialiseTargetSelect (team.GetTeamID(), desiredPosition); setComputerLane(newLane); SocketIOOutgoingEvents.PlayerSwitchLaneHandler(playerID , newLane); } }
public void RpcResetGameObject(Vector3 spawnLocation, ComputerLane computerLane, Vector3 rotation) { active = true; gameObject.GetComponent<HeroMovement>().initialiseMovement(spawnLocation); if(isServer) gameObject.GetComponent<Attack>().initiliseAttack(); if(isServer){ // initialise targeting and movement targetSelect = GetComponent<TargetSelect>(); targetSelect.InitialiseTargetSelect (team.GetTeamID(), spawnLocation); } gameObject.GetComponent<SynchronisedMovement>().ResetMovement(spawnLocation, rotation); //set Health to Max gameObject.GetComponent<Health>().InitialiseHealth(computerLane); gameObject.SetActive(active); }
void Start() { targetSelect = GetComponent<TargetSelect>(); stats = GetComponent<Stats>(); }
public override PrimaryObject[] selectFinalTargets(List <PrimaryObject> validTargetsInRange, TargetSelect targetSelectType) { switch (targetSelectType) { case TargetSelect.FIRST: return(validTargetsInRange.Take(numberOfTargets).ToArray()); case TargetSelect.HP_MOST: return(validTargetsInRange.OrderBy(c => c.getResource(ObjectResourceType.LIFE).getAmount()).Skip(validTargetsInRange.Count - numberOfTargets).ToArray()); case TargetSelect.HP_LEAST: return(validTargetsInRange.OrderBy(c => c.getResource(ObjectResourceType.LIFE).getAmount()).Take(numberOfTargets).ToArray()); case TargetSelect.CLOSEST: return(validTargetsInRange.OrderBy(c => HelperMethods.distanceSq_int(c.posCenter, source.posCenter)).Take(numberOfTargets).ToArray()); case TargetSelect.FARTHEST: return(validTargetsInRange.OrderBy(c => - HelperMethods.distanceSq_int(c.posCenter, source.posCenter)).Skip(validTargetsInRange.Count - numberOfTargets).ToArray()); case TargetSelect.RANDOM_TARGET: Random rnd = new Random(); return(validTargetsInRange.OrderBy(c => rnd.Next()).Take(numberOfTargets).ToArray()); } return(new PrimaryObject[] { }); }
void Start() { teamID = gameObject.tag.Contains("red") ? TeamID.red : TeamID.blue; if(isServer) { targetSelect = GetComponent<TargetSelect>(); } else { rendererChecker = GetComponent<RendererChecker>(); ForwardMovementTarget *= teamID == TeamID.blue ? 1 : -1; navGridManager = GameObject.FindGameObjectsWithTag("terrainSpawner")[0].GetComponent<NavGridManager>(); currentLane = GraniteNetworkManager.lane; maxX = (currentLane == ComputerLane.LEFT ? GraniteNetworkManager.numberOfScreens_left : GraniteNetworkManager.numberOfScreens_right)*CreateTerrain.chunkOffset.x - 20f; screenNumber = GraniteNetworkManager.screeNumber; nextScreenXPos = screenNumber * CreateTerrain.chunkOffset.x + (teamID == TeamID.blue ? 110 : -10); nextScreenXPos = Mathf.Clamp(nextScreenXPos, minX, maxX); // DebugConsole.Log("Next screen x is " + nextScreenXPos + " and screen is " + screenNumber); } }
public void KillMechs(int count, List <int> mechIds, BattlePlayer callerPlayer, TargetRange targetRange, TargetSelect targetSelect, int exceptMechId = -1) { List <BattlePlayer> battlePlayers = GetMechsPlayerByTargetRange(targetRange, callerPlayer); MechTypes mechType = GetMechTypeByTargetRange(targetRange); switch (targetSelect) { case TargetSelect.All: { KillMechs(GetMechsByType(battlePlayers, mechType)); break; } case TargetSelect.Multiple: { List <ModuleMech> mechs = new List <ModuleMech>(); foreach (int mechId in mechIds) { mechs.Add(GetMech(mechId)); } KillMechs(mechs); break; } case TargetSelect.MultipleRandom: { List <ModuleMech> mechs = new List <ModuleMech>(); foreach (ModuleMech mech in Utils.GetRandomFromList(GetMechsByType(battlePlayers, mechType), count)) { mechs.Add(mech); } KillMechs(mechs); break; } case TargetSelect.Single: { KillMechs(new List <ModuleMech> { GetMech(mechIds[0]) }); break; } case TargetSelect.SingleRandom: { KillMechs(new List <ModuleMech> { GetRandomMech(battlePlayers, mechType, exceptMechId) }); break; } } }
public void SideEffect_MechAction(Action <ModuleMech> action, BattlePlayer callerPlayer, int count, List <int> mechIds, TargetRange targetRange, TargetSelect targetSelect, int exceptMechId = -1) { List <BattlePlayer> battlePlayers = GetMechsPlayerByTargetRange(targetRange, callerPlayer); MechTypes mechType = GetMechTypeByTargetRange(targetRange); switch (targetSelect) { case TargetSelect.All: { foreach (ModuleMech mech in GetMechsByType(battlePlayers, mechType).ToArray()) { action(mech); } break; } case TargetSelect.Multiple: { foreach (int mechId in mechIds) { action(GetMech(mechId)); } break; } case TargetSelect.MultipleRandom: { foreach (ModuleMech mech in Utils.GetRandomFromList(GetMechsByType(battlePlayers, mechType), count)) { action(mech); } break; } case TargetSelect.Single: { if (mechIds.Count > 0) { action(GetMech(mechIds[0])); } break; } case TargetSelect.SingleRandom: { action(GetRandomMech(battlePlayers, mechType, exceptMechId)); break; } } }
public void SideEffect_ILifeAction(Action <ILife> action, BattlePlayer callerPlayer, int count, TargetRange targetRange, TargetSelect targetSelect, List <int> targetClientIds, List <int> targetMechIds) { List <BattlePlayer> mech_players = GetMechsPlayerByTargetRange(targetRange, callerPlayer); List <BattlePlayer> ship_players = GetShipsPlayerByTargetRange(targetRange, callerPlayer); switch (targetSelect) { case TargetSelect.All: { foreach (BattlePlayer player in mech_players) { List <ModuleMech> remove = new List <ModuleMech>(); foreach (ModuleMech mech in player.BattleGroundManager.Mechs) { remove.Add(mech); } foreach (ModuleMech mech in remove) { action(mech); } } foreach (BattlePlayer player in ship_players) { action(player); } break; } case TargetSelect.Multiple: { foreach (int clientId in targetClientIds) { action(GetPlayerByClientId(clientId)); } foreach (int mechId in targetMechIds) { action(GetMechOnBattleGround(mechId)); } break; } case TargetSelect.MultipleRandom: { List <ILife> lives = GetAllLifeInBattleGround(mech_players, ship_players); List <ILife> selectedLives = Utils.GetRandomFromList(lives, count); foreach (ILife life in selectedLives) { action(life); } break; } case TargetSelect.Single: { if (targetRange == TargetRange.SelfShip || targetRange == TargetRange.EnemyShip) { if (ship_players.Count > 0) { action(ship_players[0]); } } else { foreach (int targetClientId in targetClientIds) { action(GetPlayerByClientId(targetClientId)); break; } foreach (int targetMechId in targetMechIds) { if (targetMechId != Const.TARGET_MECH_SELECT_NONE) { action(GetMechOnBattleGround(targetMechId)); break; } } } break; } case TargetSelect.SingleRandom: { List <ILife> lives = GetAllLifeInBattleGround(mech_players, ship_players); List <ILife> selectedLives = Utils.GetRandomFromList(lives, 1); foreach (ILife life in selectedLives) { action(life); break; } break; } } }
public void SideEffect_ShipAction(Action <BattlePlayer> action, BattlePlayer callerPlayer, int count, TargetRange targetRange, TargetSelect targetSelect, List <int> targetClientIds) { List <BattlePlayer> players = GetShipsPlayerByTargetRange(targetRange, callerPlayer); switch (targetSelect) { case TargetSelect.All: { foreach (BattlePlayer p in players) { action(p); } break; } case TargetSelect.Multiple: { foreach (int clientId in targetClientIds) { action(GetPlayerByClientId(clientId)); } break; } case TargetSelect.MultipleRandom: { List <BattlePlayer> players_selected = Utils.GetRandomFromList(players, count); foreach (BattlePlayer p in players_selected) { action(p); } break; } case TargetSelect.Single: { if (targetRange == TargetRange.SelfShip || targetRange == TargetRange.EnemyShip || targetRange == TargetRange.SelfDeck || targetRange == TargetRange.EnemyDeck) { action(players[0]); } else if (targetRange == TargetRange.Ships || targetRange == TargetRange.Decks) { action(GetPlayerByClientId(targetClientIds[0])); } break; } case TargetSelect.SingleRandom: { action(GetRandomPlayer(1)[0]); break; } } }
// private LayerMask terrainMask = 256; void Start() { targetSelect = GetComponent<TargetSelect>(); stats = GetComponent<Stats>(); animator = GetComponentInChildren<Animator>(); animator.enabled = true; }
public override AProjectile[] createProjectiles(List <PrimaryObject> validTargetsInRange, TargetSelect targetSelectType) { throw new NotImplementedException(); }
public override AProjectile[] createProjectiles(List <PrimaryObject> validTargetsInRange, TargetSelect targetSelectType) { PrimaryObject target; switch (targetSelectType) { case TargetSelect.FIRST: target = validTargetsInRange[0]; break; case TargetSelect.HP_MOST: target = validTargetsInRange.Aggregate((curMax, c) => (curMax == null || c.getResource(ObjectResourceType.LIFE).getAmount() > curMax.getResource(ObjectResourceType.LIFE).getAmount()) ? c : curMax); // O(n) break; case TargetSelect.HP_LEAST: target = validTargetsInRange.Aggregate((curMin, c) => (curMin == null || c.getResource(ObjectResourceType.LIFE).getAmount() < curMin.getResource(ObjectResourceType.LIFE).getAmount()) ? c : curMin); // O(n) break; case TargetSelect.CLOSEST: target = validTargetsInRange.Aggregate((curMin, c) => (curMin == null || HelperMethods.distanceSq_int(c.posCenter, source.posCenter) < HelperMethods.distanceSq_int(curMin.posCenter, source.posCenter)) ? c : curMin); // O(n) break; case TargetSelect.FARTHEST: target = validTargetsInRange.Aggregate((curMax, c) => (curMax == null || HelperMethods.distanceSq_int(c.posCenter, source.posCenter) > HelperMethods.distanceSq_int(curMax.posCenter, source.posCenter)) ? c : curMax); // O(n) break; case TargetSelect.RANDOM_TARGET: int index = (new Random()).Next(validTargetsInRange.Count); target = validTargetsInRange[index]; break; case TargetSelect. default: target = null; break; } return(new AProjectile[1] { new AProjectile(source, target, dmgType, (int)(dmgRandomizer.Next(baseDmgMin, baseDmgMax + 1) * dmgInc_Perc) + dmgInc_Abs, startSpeed, acceleration) }); }