public void AddSquad(SquadManager _squad) { _squad.AssignTargetBobber(Instantiate(target_bobber_prefab)); squad_hud_manager.CreateUIBlock(_squad); squads.Add(_squad); }
// Use this for initialization void Start() { audioSource = GetComponents <AudioSource>()[0]; hitAudioSource = GetComponents <AudioSource>()[1]; tb = gameObject.GetComponent <TimeBehaviour>(); rateCounter = 0.0f; shielded = false; playCharging = false; gameObject.GetComponent <Renderer>().material = matOff; squadManager = GetComponentInParent <SquadManager>(); audioSource.Play(); audioSource.clip = gunshot; //shotTimeCounter = chargeTime; shotDurationCounter = shotDuration; wingTimeCounter = 0.0f; ela = GetComponent <EnemyLookAt>(); foreach (Transform child in transform) { if (child.gameObject.name == "AlienSniperWings") { wings = child.gameObject; break; } } }
// Use this for initialization void Start() { alive = true; squadManager = GetComponentInParent <SquadManager>(); hitAudioSource = GetComponents <AudioSource>()[1]; turbo = false; if (GameObject.FindGameObjectWithTag("Player") != null) { player = GameObject.FindGameObjectWithTag("Player"); } else { player = GameObject.FindGameObjectWithTag("PlayerDestroyed"); } if (transform.position.x < 0.0f) { direction = 1.0f; } else { direction = -1.0f; } tb = gameObject.GetComponent <TimeBehaviour>(); propellerStart = transform.GetChild(1).gameObject; propellerOn = transform.GetChild(0).gameObject; //transform.parent.GetComponentInChildren<ProtectorEnemy>().squadron.Add(gameObject); }
public static void ShowSpawnMarkers(SquadManager squadManager) { foreach (SquadTrigger squadTrigger in squadManager.SquadTriggers) { ShowSpawnMarkers(squadTrigger); } }
void grenadeUpdate() { bool activated = false; Combat.updateAoE(GetComponent <SquadManager>(), ref activated); if (activated) { List <GameObject> targets = Combat.getTargets(); foreach (GameObject target in targets) { SquadManager enemy = target.GetComponent <SquadManager>(); ShotsFired shot = new ShotsFired(this.transform.position, enemy.transform.position, enemy.getActiveUnitsCount(), BalanceConstants.Ability.GRENADE_HIT_CHANCE, enemy.dodgeChance, false); int damage = Combat.calculateDamage(shot); enemy.nView.RPC("takeDamage", RPCMode.All, damage, false); //enemy.takeDamage(damage,false); } squad.skipAction(); gameLogic.checkStateEndOfAction(); gameLogic.updateUI(); } }
private SquadManager attached_squad; // Reference. public void Init(string _squad_name, ref SquadManager _squad) { squad_text.text = _squad_name; attached_squad = _squad; Deselect(); }
private void Start() { squadButton = GetComponent <Button>(); baseColour = squadButton.colors; manager = transform.parent.GetComponent <SquadManager>(); squadName.text = "Squad " + manager.squads.Count; }
public static bool UpdateTarget(SquadManager me) { if (Input.GetButtonUp("R1") && targetsInRange.Count > 0) { gameLogic.attackProj.enabled = false; gameLogic.changeUnit.enabled = false; if (selectedTargetIndex >= 0) { targetsInRange[selectedTargetIndex].SendMessage("disableTarget"); targetsInRange[selectedTargetIndex].GetComponent <NetworkView>().RPC("disableLight", RPCMode.All); } selectedTargetIndex++; selectedTargetIndex %= targetsInRange.Count; targetsInRange[selectedTargetIndex].SendMessage("enableTarget"); targetsInRange[selectedTargetIndex].GetComponent <NetworkView>().RPC("enableLight", RPCMode.All); Vector3 enemyPos = targetsInRange[selectedTargetIndex].transform.position; //gameLogic.changeUnit.transform.position = new Vector3(enemyPos.x, 9, enemyPos.z); //gameLogic.changeUnit.enabled = true; } else if (Input.GetButtonUp("L1") && targetsInRange.Count > 0) { gameLogic.attackProj.enabled = false; if (selectedTargetIndex >= 0) { targetsInRange[selectedTargetIndex].SendMessage("disableTarget"); targetsInRange[selectedTargetIndex].GetComponent <NetworkView>().RPC("disableLight", RPCMode.All); } else { selectedTargetIndex = 0; } selectedTargetIndex--; if (selectedTargetIndex < 0) { selectedTargetIndex = targetsInRange.Count - 1; } { targetsInRange[selectedTargetIndex].SendMessage("enableTarget"); targetsInRange[selectedTargetIndex].GetComponent <NetworkView>().RPC("enableLight", RPCMode.All); } Vector3 enemyPos = targetsInRange[selectedTargetIndex].transform.position; //gameLogic.changeUnit.transform.position = new Vector3(enemyPos.x, 9, enemyPos.z); //gameLogic.changeUnit.enabled = true; } if (Input.GetButtonUp("Cross") && targetsInRange.Count > 0 && selectedTargetIndex >= 0) { return(true); } return(false); }
private void CheckClick() { // if we click anywhere on screen with right mouse button if (Input.GetMouseButtonDown(0)) { // send ray RaycastHit hit; Ray clickRay = cam.ScreenPointToRay(Input.mousePosition); // if raycast hit to an object if (Physics.Raycast(clickRay, out hit, Mathf.Infinity, raycastMask)) { if (hit.collider.transform.tag == "Building") //check for tags { BuildingStandard tempBuild; tempBuild = hit.collider.gameObject.GetComponent <BuildingStandard>(); foreach (var choosen in selection) { //clear selections if building type is different or there is no building on selection before if (choosen.gameObject.tag != "Building") { CleanSelection(); break; } else if (choosen.GetComponent <BuildingStandard>().main.Type != tempBuild.main.Type) { CleanSelection(); break; } } if (tempBuild.Team == teamID) { //if its in my team and constructed tempBuild.Select(true); //set barrack seleceted selection.Add(tempBuild.gameObject); //add barracks to selection } } else if (hit.collider.transform.tag == "Squad") { SquadManager tempSquad = hit.collider.gameObject.GetComponent <SquadManager>(); if (tempSquad.Team == teamID) //if its ally, make squad controllable { selection.Add(tempSquad.gameObject); tempSquad.Select(true); } else { Attack(tempSquad.gameObject); //attack him, he is an enemy } } else { CleanSelection(); } } } }
void Start() { fxManager = controlledMinion.GetComponentInChildren <FXManager>(); playerRig = controlledMinion.GetComponent <Rigidbody>(); currentCameraPositionOffset = new Vector3(0, 16.93f, -7.85f); controlledMinion.GetComponentInChildren <Image>().enabled = true; currentCameraCamera = currentCamera.GetComponentInChildren <Camera>().gameObject.transform; squadManager = FindObjectOfType <GameplayManager>().squadManager; }
public void ReinforceSquad() { if (selected) { if (!working || (working && (CheckForEmptyPlaceholders() > 0))) { working = true; GameObject squadCollider = null; foreach (var collider in Physics.OverlapSphere(transform.position, 4)) { if (collider.tag == "Squad") { squadCollider = collider.gameObject; } else if (collider.tag == "man") { squadCollider = collider.gameObject.GetComponent <SquadMemberManager>().mySquadManager.gameObject; } } if (squadCollider != null) { SquadManager _squadInfo = squadCollider.GetComponent <SquadManager>(); if (_squadInfo.Team == secondInfo.Team && (_squadInfo.ManCount < _squadInfo.SquadInfo.MaxCount)) { List <GameObject> _placeholders = _squadInfo.Placeholders; GameObject _squadParent = null; GameObject _emptyPlaceholder = null; statusBar.gameObject.SetActive(true); manSpawnTime = _squadInfo.SquadInfo.ReinforceTime; statusBar.value = 0; statusBar.maxValue = manSpawnTime; foreach (GameObject _tempEmptyPlaceholder in placeholders) { if (_tempEmptyPlaceholder.GetComponent <PlaceHolderInfo>().Empty) { _emptyPlaceholder = _tempEmptyPlaceholder; } } foreach (var go in squadCollider.GetComponentsInChildren <Transform>()) { if (go.name == "SquadMembers") { _squadParent = go.gameObject; } } if (_emptyPlaceholder != null) { _emptyPlaceholder.GetComponent <PlaceHolderInfo>().Empty = false; SpawnMans(_emptyPlaceholder, squadCollider, _squadParent); _squadInfo.ManCount++; } } } } } }
// >> squad section /// <summary> /// Возвращает список всех отрядов /// </summary> /// <param name="obj"></param> /// <returns></returns> public IEnumerable <SquadEntity> GetSquads(SquadAction obj) { var result = Tools.CheckAuthedInput(obj); if (result != "passed") { return(null); } return(Tools.EnumSmartMapper <gamelogic.Squad, SquadEntity>(SquadManager.GetSquads())); }
public SquadBlock CreateUIBlock(SquadManager _squad) { GameObject clone = Instantiate(squad_block_prefab, squad_grid_layout); SquadBlock block = clone.GetComponent <SquadBlock>(); block.Init("Squad " + (squad_blocks.Count + 1).ToString(), ref _squad); squad_blocks.Add(block); return(block); }
public void SquadManagerHigherLevelTest() { Levels level = new Levels(LevelTest.MockConfig()); SquadManager new_squadmanager = new SquadManager(level); int start_squad_size = new_squadmanager.GetMaxSquadsize(); int start_selectibe_units = new_squadmanager.GetUnlockedTiers().Count; level.AddProgress(10000000); Assert.Less(start_selectibe_units, new_squadmanager.GetUnlockedTiers().Count, "DIDNT UNLOCK UNITS"); Assert.Less(start_squad_size, new_squadmanager.GetMaxSquadsize(), "DIDNT UNLOCK SQUAD SIZE"); }
void Start() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); return; } }
void OnSelect(Unlockable <TieredUnit> tier) { MDebug.Log("SQUAD SELECTER SELECT TIER " + tier.Item.Tiers[0].Config.ID); if (SquadManager.Instance.selected_units.Contains(tier.Item)) { selector_buttons.GetView(tier).SetUnselected(); SquadManager.RemoveFromSquad(tier.Item); } else if (SquadManager.AddToSquad(tier)) { selector_buttons.GetView(tier).SetSelected(); } }
void Awake() { //_instance = this; if (_instance == null) { DontDestroyOnLoad(gameObject); _instance = this; } else if (_instance != this) { Destroy(gameObject); } }
public static void TrackingCall_LevelStart(RegionConfigDataBase region, SquadManager squad, PlayerLevel level) { Dictionary <string, object> call = new Dictionary <string, object>(); call["player_level"] = level.GetCurrentLevel(); call["int"] = squad.selected_units; call["cleared"] = region.IsCompleteInSave().ToString(); call["editor"] = Application.isEditor.ToString(); Analytics.CustomEvent("mission_start_" + region.name, call); }
//Show single marker for squad trigger's location, will change focus to when clicked public static void ShowSquadTriggerMarkers(SquadManager squadManager) { Handles.color = Color.green; foreach (SquadTrigger squadTrigger in squadManager.SquadTriggers) { //Spawn button marker at location of squad if (Handles.Button(squadTrigger.transform.position, Quaternion.identity, 0.20f, 0.20f, Handles.DotCap)) { //Make squad active GameObject in Hierarchy Selection.activeGameObject = squadTrigger.gameObject; } } }
/// <summary> /// Creates a new squad with the passed faction settings. /// The squaddies are arranged in a circular pattern at the passed position, based on the squad size. /// </summary> /// <param name="_faction">The faction of the squad.</param> /// <param name="_num_squaddies">The size of the squad.</param> /// <param name="_pos">The where the squad should be arranged.</param> /// <returns>A reference to the instantiated squad.</returns> public SquadManager CreateSquad(FactionSettings _faction, int _num_squaddies, Vector3 _pos) { SquadManager squad_manager = new SquadManager(_faction); for (int i = 0; i < _num_squaddies; ++i) { SquaddieAI squaddie = CreateSquaddie(_faction, _pos); squaddie.transform.position = JHelper.PosToCirclePos(_pos, _num_squaddies, i, _num_squaddies * 0.5f); squad_manager.AddSquaddie(squaddie); } return(squad_manager); }
public MissionOutcome(SquadManager manager, PlayerLevel level, PlayerInventory inventory, GameManager game_manager) : this(manager.killed.Count, manager.evacuated.Count, inventory.GetItem(ItemTypes.dust).GetCount(), manager.selected_units.Count, game_manager.ChoosenRegionConfig.Difficulty, level.GetProgressInLevel(), level.GetCurrentLevel(), level.GetCurrentLevel()) { PlayerInventory.Instance.ModifyItem(ItemTypes.saved_dust, LastOutcome.SuppliesGainedFinal); PlayerInventory.Instance.GetItem(ItemTypes.saved_dust).SaveValue(); level.AddProgress(LastOutcome.SuppliesGainedFinal); PlayerInventory.Instance.ModifyItem(ItemTypes.dust, -PlayerInventory.Instance.GetItem(ItemTypes.dust).GetCount()); if (manager.evacuated.Count > 0) { game_manager.ChoosenRegionConfig.CompleteInSave(); } OnMissionOutcomeSet.AttemptCall(this); }
// Use this for initialization void Start() { audioSource = GetComponents <AudioSource>()[0]; hitAudioSource = GetComponents <AudioSource>()[1]; recovering = false; cooldownCounter = cooldown; tb = gameObject.GetComponent <TimeBehaviour>(); squadManager = GetComponentInParent <SquadManager>(); squadron.Clear(); foreach (BasicEnemy e in transform.parent.GetComponentsInChildren <BasicEnemy>()) { squadron.Add(e.gameObject); } audioSource.Play(); }
/// <summary> /// Determines the team for the new StrategyPlayer and /// gives it a list of prefabs that determine its squad. /// </summary> /// <param name="squad">The new strategy player's squadmanager</param> public void NewPlayer(SquadManager squad) { Debug.Log("================== NEW PLAYER! =================="); Debug.Log("Player Count: " + playerCount); // Determine which type of player to add (light or dark) squad.team = playerCount % 2; Debug.Log("Team: " + playerCount % 2); Debug.Log("Team: " + (ETeam)squad.team); // Set list of prefabs for squad based on team squad.prefabs = ((ETeam)squad.team == ETeam.Light) ? lightPrefabs : darkPrefabs; Debug.Log("Prefabs Length: " + squad.prefabs.Length); }
// Use this for initialization void Start () { Manager = gameObject.GetComponentInParent<SquadManager> (); Scanning = true; tileCheck = gameObject.GetComponentInChildren<CastDown> (); Nav = gameObject.GetComponent<NavMeshAgent> (); Nav.acceleration = 9999999f; Destination= transform; bestPos = transform.position + 10000 * Vector3.forward +1000*Vector3.left; InvokeRepeating ("changeSign", 0, 5); transform.Rotate (Vector3.up * -70); // Debug.Log (bestPos); // See (); // InvokeRepeating ("Move", 0, 1); }
public void shotgunInit() { squad = GetComponent <SquadManager>(); gameLogic = GameObject.Find("GameLogic").GetComponent <Controller>(); squad.size = 4; squad.attackDistance = 20; squad.movementDistance = 30; squad.squadType = "Shotgun"; squad.unitTargets = new Transform[squad.size]; for (int i = 0; i < squad.size; i++) { squad.unitTargets[i] = new GameObject().transform; squad.unitTargets[i].parent = transform; squad.unitTargets[i].localPosition = Quaternion.Euler(0, i * 360 / squad.size, 0) * Vector3.forward * 1.5f; } GameObject unitPrefab = (GameObject)Resources.Load("UnitShotgun"); if (unitPrefab == null) { throw new MissingReferenceException("Failed to find Unit Prefab."); } squad.units = new GameObject[squad.size]; for (int i = 0; i < squad.size; i++) { squad.units[i] = (GameObject)Instantiate(unitPrefab, squad.unitTargets[i].position, Quaternion.identity); squad.units[i].transform.position = squad.unitTargets[i].position; squad.units[i].GetComponent <UnitManager>().power = BalanceConstants.Stats.SHOTGUN_POWER; } squad.units[squad.units.Length - 1].GetComponent <UnitManager>().power *= 2; squad.units[squad.units.Length - 1].GetComponent <UnitManager>().isSpecial = true; squad.units[squad.units.Length - 1].transform.localScale = new Vector3(1.25f, 1.25f, 1.25f); squad.unitAbility = new SquadManager.Ability(smokeScreen); squad.squadAbility = new SquadManager.Ability(shotBlast); squad.unitAbilityUpdate = new SquadManager.AbilityUpdate(smokeScreenUpdate); squad.squadAbilityUpdate = new SquadManager.AbilityUpdate(shotBlastUpdate); squad.paintColor(); isInit = true; }
// Use this for initialization void Start() { squadManager = GetComponentInParent <SquadManager>(); audioSource = GetComponents <AudioSource>()[0]; hitAudioSource = GetComponents <AudioSource>()[1]; tb = gameObject.GetComponent <TimeBehaviour>(); shotCounter = numberOfShots; shotTimeCounter = rateOfFire; rateCounter = 0.0f; shielded = false; gameObject.GetComponent <Renderer>().material = matOn; //ProtectorEnemy pe = transform.parent.GetComponentInChildren<ProtectorEnemy>(); //if (pe) pe.squadron.Add(gameObject); audioSource.Play(); audioSource.clip = gunshot; gameObject.GetComponent <Renderer>().material = matOn; }
void ChangeSquadSelection(int _squad_number) { if (selected_squad != null) { selected_squad.DeselectSquad(); } SquadManager target_squad = squads[_squad_number]; if (selected_squad != target_squad) { OrderFinished(); } selected_squad = target_squad; selected_squad.SelectSquad(); }
// Start is called before the first frame update void Start() { if (_i) { Debug.Log("WARNING: MULTIPLE INSTANCES OF SQUAD MANAGER"); return; } _i = this; squads = new List <Squad>(); // max = lowest val int max = squad_sizes.Length > squad_spawns.Length ? squad_spawns.Length : squad_sizes.Length; for (int i = 0; i < max; ++i) { squads.Add(new Squad(squad_sizes[i], squad_spawns[i])); } selectSquad(0); }
public void sniperInit() { squad = GetComponent<SquadManager>(); gameLogic = GameObject.Find("GameLogic").GetComponent<Controller>(); squad.size = 2; squad.attackDistance = 30; squad.movementDistance = 20; squad.squadType = "Sniper"; squad.unitTargets = new Transform[squad.size]; for (int i = 0; i < squad.size; i++) { squad.unitTargets[i] = new GameObject().transform; squad.unitTargets[i].parent = transform; squad.unitTargets[i].localPosition = Quaternion.Euler(0, i * 360 / squad.size, 0) * Vector3.forward * 1.5f; } GameObject unitPrefab = (GameObject)Resources.Load("UnitSniper"); if (unitPrefab == null) throw new MissingReferenceException("Failed to find Unit Prefab."); squad.units = new GameObject[squad.size]; for (int i = 0; i < squad.size; i++) { squad.units[i] = (GameObject)Instantiate(unitPrefab, squad.unitTargets[i].position, Quaternion.identity); squad.units[i].transform.position = squad.unitTargets[i].position; squad.units[i].GetComponent<UnitManager>().power = BalanceConstants.Stats.BASIC_POWER; } squad.units[squad.units.Length - 1].GetComponent<UnitManager>().power = 4; squad.units[squad.units.Length - 1].GetComponent<UnitManager>().isSpecial = true; squad.units[squad.units.Length - 1].transform.localScale = new Vector3(1.25f, 1.25f, 1.25f); squad.unitAbility = new SquadManager.Ability(sniperShot); squad.squadAbility = new SquadManager.Ability(smokeScreen); squad.unitAbilityUpdate = new SquadManager.AbilityUpdate(sniperShotUpdate); squad.squadAbilityUpdate = new SquadManager.AbilityUpdate(smokeScreenUpdate); squad.paintColor(); }
public void ApproveApplication() { if (applicants.Count > 0) { //do some flashy fun stuff here Player player = GameObject.Find("Player").GetComponent <Player>(); player.nauts.Add(applicants[index]); naut_dropdown.AddOptions(new List <string>() { (applicants[index].name) }); applicants.RemoveAt(index); if (player.nauts.Count == 1) { SquadManager sm = GameObject.Find("SquadManager").GetComponent <SquadManager>(); sm.FillUI(); } FillUI(); } }
public static void updateAoE(SquadManager me, ref bool activated) { gameLogic.attackProj.transform.position = new Vector3(marker.transform.position.x, 9, marker.transform.position.z); if (Input.GetButtonUp("Cross")) { activated = true; if (markerAttack > 0) { findTargets(marker.gameObject, markerAttack); } Camera.main.GetComponent <CameraController>().setCameraTarget(me.transform.position, true); } if (Input.GetButtonDown("Circle")) { reset(); Camera.main.GetComponent <CameraController>().setCameraTarget(me.transform.position, true); } }
public static void SpawnRegion(RegionConfig region, TileManager target) { TileManager instance = Instantiate(region.TileSet).gameObject.GetComponent <TileManager>(); target.AppendGrid(instance); //spawn the units and shit UnitSpawnManager spawner = instance.GetComponent <UnitSpawnManager>(); List <UnitSpawnGroupConfig> groups = RegionLoader.GetGroupsForPower(region); if (region.SpawnSquad) { groups.Add(SquadManager.MakeSquadGroup()); } // MDebug.Log("Spawn Groups " + groups.Count); spawner.SpawnGroups(groups); }
// Use this for initialization void Start () { Cheat = false; Nav = gameObject.GetComponent<NavMeshAgent> (); Manager = gameObject.GetComponentInParent<SquadManager> (); Nav.acceleration = 9999999f; }
public static bool UpdateTarget(SquadManager me) { if (Input.GetButtonUp("R1") && targetsInRange.Count > 0) { gameLogic.attackProj.enabled = false; gameLogic.changeUnit.enabled = false; if (selectedTargetIndex >= 0) { targetsInRange[selectedTargetIndex].SendMessage("disableTarget"); targetsInRange[selectedTargetIndex].GetComponent<NetworkView>().RPC("disableLight", RPCMode.All); } selectedTargetIndex++; selectedTargetIndex %= targetsInRange.Count; targetsInRange[selectedTargetIndex].SendMessage("enableTarget"); targetsInRange[selectedTargetIndex].GetComponent<NetworkView>().RPC("enableLight", RPCMode.All); Vector3 enemyPos = targetsInRange[selectedTargetIndex].transform.position; //gameLogic.changeUnit.transform.position = new Vector3(enemyPos.x, 9, enemyPos.z); //gameLogic.changeUnit.enabled = true; } else if (Input.GetButtonUp("L1") && targetsInRange.Count > 0) { gameLogic.attackProj.enabled = false; if (selectedTargetIndex >= 0) { targetsInRange[selectedTargetIndex].SendMessage("disableTarget"); targetsInRange[selectedTargetIndex].GetComponent<NetworkView>().RPC("disableLight", RPCMode.All); } else selectedTargetIndex = 0; selectedTargetIndex--; if (selectedTargetIndex < 0) selectedTargetIndex = targetsInRange.Count - 1; { targetsInRange[selectedTargetIndex].SendMessage("enableTarget"); targetsInRange[selectedTargetIndex].GetComponent<NetworkView>().RPC("enableLight", RPCMode.All); } Vector3 enemyPos = targetsInRange[selectedTargetIndex].transform.position; //gameLogic.changeUnit.transform.position = new Vector3(enemyPos.x, 9, enemyPos.z); //gameLogic.changeUnit.enabled = true; } if (Input.GetButtonUp("Cross") && targetsInRange.Count > 0 && selectedTargetIndex >= 0) { return true; } return false; }
public static void updateAoE(SquadManager me, ref bool activated) { gameLogic.attackProj.transform.position = new Vector3(marker.transform.position.x, 9, marker.transform.position.z); if (Input.GetButtonUp("Cross")) { activated = true; if(markerAttack > 0) findTargets(marker.gameObject, markerAttack); Camera.main.GetComponent<CameraController>().setCameraTarget(me.transform.position, true); } if (Input.GetButtonDown("Circle")) { reset(); Camera.main.GetComponent<CameraController>().setCameraTarget(me.transform.position, true); } }