public void OpenAndSpawnByName(string passengerName, Spawner.TicketAdditionMode ticketMode) { _animator.enabled = true; _animator.Play("doors_open"); _unitSpawner.Spawn(gameObject, passengerName, ticketMode); _isOpened = true; }
public void ShouldThrowExceptionIfProgramDoesntExist() { using (var spawner = new Spawner()) { Assert.Throws(typeof (ArgumentException), () => spawner.Spawn(new StartInfo {ProgramName = "asdf"})); } }
void Start() { _spawner = FindObjectOfType<Spawner>(); targetRoom = _spawner._rooms[Random.Range(0, _spawner._rooms.Count)]; destination = targetRoom.transform.position; transform.position = targetRoom.transform.up*50f + targetRoom.transform.position; }
void Start () { gmc = GameObject.FindGameObjectWithTag("GameController").GetComponent<Spawner>(); print(gmc.sprites[gmc.num]); /*anim = GameObject.FindGameObjectsWithTag("animation"); anim.SetActive(false);*/ skeletonAnimation = GameObject.FindGameObjectWithTag("animation").GetComponent<SkeletonAnimation>(); skeletonAnimation.enabled = true; gmv = GameObject.FindGameObjectWithTag("GameOver"); cnt = GameObject.FindGameObjectWithTag("animation"); //gmv.SetActive(false); gameOv =GameObject.FindGameObjectWithTag("GameOver").GetComponent<SkeletonAnimation>(); if(this.gameObject.GetComponent<TapCounter>().enabled){ skeletonAnimation.state.SetAnimation(0, "tap_amount_in", false); skeletonAnimation.state.AddAnimation(0, "tap_amount_loop", true, 0.3f); } gmv.SetActive(false); cnt.SetActive(true); /*gmv = GameObject.FindGameObjectWithTag("GameOver"); cnt = GameObject.FindGameObjectWithTag("animation"); gmv.SetActive(false);*/ AudioSource[] sources = GetComponents<AudioSource>(); tap = sources[0]; bad = sources[1]; good = sources[2]; spw = GameObject.FindGameObjectWithTag("GameController").GetComponent<Spawner>(); sc = GameObject.FindGameObjectWithTag("Score").GetComponent<ScoreController>(); scoreCounter.text = ""; }
void Awake() { Application.targetFrameRate = 60; player = GameObject.Find("Player").GetComponent<Player>(); spawner = GameObject.Find("Spawner").GetComponent<Spawner>(); Score = Hud.GetComponent<Score>(); }
//private bool WeaponToggle; void Awake() { floor = GameObject.Find ("Foreground"); spawner = GameObject.Find ("Spawner").GetComponent<Spawner> (); //weaponmanager = GameObject.Find ("WeaponManager").GetComponent<WeaponManager>(); timeManager = GetComponent<TimeManager> (); }
public override void Init(Spawner spawner) { base.Init(spawner); VFX.Instance.ParentEffectIf("fire", transform, new Vector2(-0.85f, 1.7f), -Mathf.PI / 2, IsShooting); VFX.Instance.ParentEffectIf("fire", transform, new Vector2(0.75f, 1.7f), -Mathf.PI / 2, IsShooting); }
private void BeginGame() { if (SpawnerPrefab != null) { _spawnerInstance = Instantiate(SpawnerPrefab) as Spawner; _spawnerInstance.Spawn(); } }
void Start() { //Load the given objects from ressource folder, for later use player = Resources.Load("Spaceships/Player", typeof(GameObject)) as GameObject; pilotAI = Resources.Load("Spaceships/PlayerAI", typeof(GameObject)) as GameObject; spawner = Resources.Load("Spawner", typeof(GameObject)) as GameObject; combatHUD = Resources.Load("HUD/CombatHUD", typeof(GameObject)) as GameObject; enemy = Resources.Load("Enemy", typeof(GameObject)) as GameObject; enemyHUD = Resources.Load("HUD/EnemyHUD", typeof(GameObject)) as GameObject; playerHUD = Resources.Load("HUD/PlayerHUD", typeof(GameObject)) as GameObject; //Types of drops commonDrop = Resources.Load("Drops/CommonDrop", typeof(GameObject)) as GameObject; uncommonDrop = Resources.Load("Drops/UncommonDrop", typeof(GameObject)) as GameObject; rareDrop = Resources.Load("Drops/RareDrop", typeof(GameObject)) as GameObject; healthDrop = Resources.Load("Drops/HealthDrop", typeof(GameObject)) as GameObject; shieldDrop = Resources.Load("Drops/ShieldDrop", typeof(GameObject)) as GameObject; powerDrop = Resources.Load("Drops/PowerDrop", typeof(GameObject)) as GameObject; getPlayers = GameObject.FindGameObjectsWithTag("Pilot"); getAIs = GameObject.FindGameObjectsWithTag("PilotAI"); Instantiate(spawner, new Vector2(10, 0), Quaternion.identity); // Spawn spawner spawnerScript = GameObject.Find("Spawner(Clone)").GetComponent<Spawner>(); Instantiate(combatHUD, transform.position, Quaternion.identity); // Spawn AI GUI waveOutcome = WaveOutcomes.Waiting; #region Next Round timer nextRoundTimer = new Timer(5000); nextRoundTimer.Elapsed += new ElapsedEventHandler(NextRound); nextRoundTimer.Enabled = true; callNewRound = false; #endregion }
void Awake() { if( _instance == null ) _instance = this; else Destroy( gameObject ); }
void Awake () { spawner = GetComponent<Spawner>(); maxHorizontalShift = GameSettings.SmallPlatformWidth / 2; maxVerticalShift = GameSettings.SmallPlatformHeight / 2; smallPlatformHeight = GameSettings.SmallPlatformHeight; smallPlatformWidth = GameSettings.SmallPlatformWidth; }
public void InitSpawners() { for (int i = 0; i < spawners.Length; i++) { spawnerCon = spawners[i].GetComponent<Spawner> (); spawnerCon.GetReady(); } }
void Awake() { playerGoal = (Goal)GameObject.Find("PGoal").GetComponent(typeof(Goal)); shadowGoal = (Goal)GameObject.Find("SGoal").GetComponent(typeof(Goal)); player = GameObject.Find("Player"); shadow = GameObject.Find("Shadow"); spawner = (Spawner)gameObject.GetComponent(typeof(Spawner)); }
// Use this for initialization void Start() { steeringBasics = GetComponent<SteeringBasics>(); hide = GetComponent<Hide>(); obstacleSpawner = GameObject.Find("ObstacleSpawner").GetComponent<Spawner>(); wallAvoid = GetComponent<WallAvoidance>(); }
public static Spawner getInstance () { if(!instance) { container = new GameObject(); container.name = "Spawner"; instance = container.AddComponent(typeof(Spawner)) as Spawner; } return instance; }
public void FirstUpdate(GameTime gameTime) { Music.Beat += new EventHandler(Tower.OnBeat); Music.Bar += new EventHandler(OnBar); Tower.ZeroHealth += new EventHandler(GameOver); spawner = new Spawner(); Music.Start(gameTime.TotalRealTime); }
// Use this for initialization void Awake() { floor = GameObject.Find ("Foreground"); spawner = GameObject.Find ("Spawner").GetComponent<Spawner>(); timeManager = GetComponent<TimeManager> (); print ("Hey"); print (timeManager); }
// Use this for initialization protected void Start() { spawner = GetComponent<Spawner>(); if ( ! spawner ) Debug.LogError( "A spawn-on behaviour requires a Spawner base component attached to the game-object - not found!" ); if( autoStart ) startSpawning(); }
//private Controller control; void Start() { health = _maxHealth; magic = _maxMagic; score = 0; _spawn = this.GetComponent<Spawner>(); _spawn.SetUp(); _control = this.GetComponent<Controller>(); }
// Use this for initialization void Start() { m_playerManager = GetComponent<PlayerManager>(); m_projectileManager = GetComponent<ProjectileManager>(); m_shipManager = GetComponent<ShipManager>(); m_spawner = GetComponent<Spawner>(); kills = 0; timeGameEnded = 0.0f; }
// Use this for initialization public void Start() { levelManager = GameObject.FindObjectOfType<LevelManager>(); spawner = GameObject.FindObjectOfType<Spawner>(); if (spawner != null) { transform.position = new Vector2(levelManager.maxX, UnityEngine.Random.Range(levelManager.minY, levelManager.maxY)); GetComponent<Rigidbody2D>().AddForce(new Vector2(-200 * spawner.flyerSpeed * UnityEngine.Random.Range(1f, 1.5f), 0)); } rotation = new Vector3(0,0,Random.Range (-3f,3f)); }
public void Upgrade(Spawner spawner, UnitUpgrade upgrade) { // if there are more tiers, and we have the money, upgrade the selected spawner if ( spawner!=null && upgrade!=null && currentMoney > upgrade.cost ) { currentMoney -= upgrade.cost; spawner.currentUpgrade= upgrade; spawner.transform.FindChild("Barrack").renderer.material.color = upgrade.barrackColor; } }
// Use this for initialization void Start() { spawner = new Spawner(); if(People!=null) spawner.setPrototype(People); s1 = new SpawnerFor<PeoPleMonster>(); s2 = new SpawnerFor<AnimalMonster>(); s1.setPrototype(People); s2.setPrototype(Animal); }
void SetMyLaneSpawner() { Spawner[] allSpawners = GameObject.FindObjectsOfType<Spawner>(); foreach (Spawner thisSpawner in allSpawners){ if(thisSpawner.transform.position.y==transform.position.y){ myLaneSpawner = thisSpawner; return; } } Debug.LogError (name + " can't find spawner in Lane"); }
// Use this for initialization void Awake() { score = 0; playerController = GameObject.Find("Player").GetComponent<PlayerController>(); roadManager = GameObject.Find("RoadManager").GetComponent<RoadManager>(); spawner = GameObject.Find("Spawner").GetComponent<Spawner>(); scoreText = GameObject.Find("ScoreText").GetComponent<Text>(); restartText = GameObject.Find("ScoreCanvas").transform.GetChild(1).GetComponent<Text>(); restartText.enabled = false; }
void setCurrentLaneSpawner() { Spawner[] spawnerArray = GameObject.FindObjectsOfType(typeof(Spawner)) as Spawner[]; foreach(Spawner spawner in spawnerArray){ if (spawner.transform.position.y == transform.position.y){ currentSpawner = spawner; return; } } Debug.LogError("Cannot find appropriate Lane"); }
/* public void SpawnFromAll(Spawner.Type spawnerType, Vector2 direction, int spawnIndex) { for(int i = 0; i < levelSpawners.Count; i++) { if(levelSpawners[i].spawnerType == spawnerType && levelSpawners[i].spawnDirection == direction) { levelSpawners[i].CycleThroughMovementsAndSpawn(spawnIndex); } } }*/ public void ActivateLevelSpawners(Spawner.Type type) { Debug.Log("Activate Scenery " + type); for (int i=0; i< levelSpawners.Count; i++) { if (levelSpawners[i].spawnerType == type) { levelSpawners[i].Activate(); //Debug.Log(levelSpawners[i].name + "Activated"); } } }
//Look through all spawners, and set myLaneSpawner if found void SetMyLaneSpawner() { Spawner[] spawnerArray = GameObject.FindObjectsOfType<Spawner> (); foreach (Spawner spawner in spawnerArray) { if (spawner.transform.position.y == transform.position.y){ myLaneSpawner = spawner; return; } } Debug.LogError (name + " can't find spawner in lane"); }
void Awake() { Application.runInBackground = true; spawner = GameObject.Find("Spawner").GetComponent<Spawner>(); ns = GameObject.Find("Networking").GetComponent<NetworkingServer>(); _ps = transform.FindChild("Puskur").particleSystem; if (ns == null) { _mechaController = GameObject.Find("Mecha").GetComponent<UpdateMechaRotation>(); } _ps.enableEmission = false; StartCoroutine("TimeOut"); }
void Start() { roundInfo = GameObject.Find("Round Info").GetComponent<Text>(); roundEnd = GameObject.Find("Round End").GetComponent<Text>(); getAIHUDs = GameObject.FindGameObjectsWithTag("Health Bar AI"); gameController = GameObject.FindGameObjectWithTag("GameController"); gameControllerScript = gameController.GetComponent<GameController>(); spawnerScript = GameObject.FindGameObjectWithTag("Spawner").GetComponent<Spawner>(); NewRound(); } // Use this for initialization
void Awake() { floor = GameObject.Find("Foreground"); spawner = GameObject.Find("Spawner").GetComponent <Spawner> (); //because spawner is a script. we also have a gameobj named spawner. timeManager = GetComponent <TimeManager>(); }
public void Awake() { Instance = this; }
void Awake() { spawner = FindObjectOfType <Spawner> (); }
private void Awake() { instance = GameObject.Find("GameState").GetComponent <GameState>(); spawner = GameObject.Find("Spawner").GetComponent <Spawner>(); }
void Update() { if (GameStart && !GameFinished) { PartyStartCounter.fillAmount -= Time.deltaTime / 60; if (PartyStartCounter.fillAmount <= 0) { GameFinished = true; } NotStart.SetActive(false); if (boomerangrate <= 0) { int temps = temporary(); if (temps == 2) { Boomerang[Random.Range(0, Boomerang.Length)].SetActive(false); Boomerang[Random.Range(0, Boomerang.Length)].SetActive(true); } boomerangrate = boomerangTimeInterval; } else { boomerangrate -= Time.deltaTime; } if (IsFireOn) { GameOverCounterImage.SetActive(false); if (fireRate <= 0) { candleLight.SetActive(false); fireRate = FireTime; Instantiate(efek, efekPlay.position, Quaternion.identity); GameOverCounter.fillAmount = GameOverCoutdown; OnGOcountdown = true; IsFireOn = false; } else { fireRate -= Time.deltaTime; } } if (OnGOcountdown) { GameOverCounterImage.SetActive(true); if (GameOverCounter.fillAmount <= 0) { GameFinished = true; } else { GameOverCounter.fillAmount -= Time.deltaTime / 4; } } if (Hp <= 0) { GameFinished = true; } if (Input.GetKeyDown(KeyCode.Escape)) { if (IsPaused) { UnPaused(); } else { Paused(); } } } if (GameFinished) { GameOverPanel.SetActive(true); Destroy(GameObject.FindGameObjectWithTag("Junk")); Spawner.SetActive(false); if (PartyStartCounter.fillAmount <= 0) { if (candleLight.activeSelf) { if (Hp == 3) { Rank.text = "the party started\nYour rank : S"; } else if (Hp == 2) { Rank.text = "the party started\nYour rank : A"; } else if (Hp == 1) { Rank.text = "the party started\nYour rank : B"; } else { Rank.text = "the party started\nYour rank : C"; } } else { Rank.text = "the party not started you need burning candle to start party\nYour rank : F"; } } else if (GameOverCounter.fillAmount <= 0) { Rank.text = "the party not started you need burning candle to start party\nYour rank : F"; } else { Rank.text = "You failed protect your cake\nYour rank : F"; } } }
partial void RespawnCharactersProjSpecific(Vector2?shuttlePos) { respawnedCharacters.Clear(); var respawnSub = RespawnShuttle ?? Submarine.MainSub; MultiPlayerCampaign campaign = GameMain.GameSession.GameMode as MultiPlayerCampaign; var clients = GetClientsToRespawn().ToList(); foreach (Client c in clients) { //get rid of the existing character c.Character?.DespawnNow(); c.WaitForNextRoundRespawn = null; var matchingData = campaign?.GetClientCharacterData(c); if (matchingData != null && !matchingData.HasSpawned) { c.CharacterInfo = matchingData.CharacterInfo; } //all characters are in Team 1 in game modes/missions with only one team. //if at some point we add a game mode with multiple teams where respawning is possible, this needs to be reworked c.TeamID = CharacterTeamType.Team1; if (c.CharacterInfo == null) { c.CharacterInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, c.Name); } } List <CharacterInfo> characterInfos = clients.Select(c => c.CharacterInfo).ToList(); //bots don't respawn in the campaign if (campaign == null) { var botsToSpawn = GetBotsToRespawn(); characterInfos.AddRange(botsToSpawn); } GameMain.Server.AssignJobs(clients); foreach (Client c in clients) { if (campaign?.GetClientCharacterData(c) == null || c.CharacterInfo.Job == null) { c.CharacterInfo.Job = new Job(c.AssignedJob.First, c.AssignedJob.Second); } } //the spawnpoints where the characters will spawn var shuttleSpawnPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, respawnSub); //the spawnpoints where they would spawn if they were spawned inside the main sub //(in order to give them appropriate ID card tags) var mainSubSpawnPoints = WayPoint.SelectCrewSpawnPoints(characterInfos, Submarine.MainSub); ItemPrefab divingSuitPrefab = null; if ((shuttlePos != null && Level.Loaded.GetRealWorldDepth(shuttlePos.Value.Y) > Level.DefaultRealWorldCrushDepth) || Level.Loaded.GetRealWorldDepth(Submarine.MainSub.WorldPosition.Y) > Level.DefaultRealWorldCrushDepth) { divingSuitPrefab = ItemPrefab.Prefabs.FirstOrDefault(it => it.Tags.Any(t => t.Equals("respawnsuitdeep", StringComparison.OrdinalIgnoreCase))); } if (divingSuitPrefab == null) { divingSuitPrefab = ItemPrefab.Prefabs.FirstOrDefault(it => it.Tags.Any(t => t.Equals("respawnsuit", StringComparison.OrdinalIgnoreCase))) ?? ItemPrefab.Find(null, "divingsuit"); } ItemPrefab oxyPrefab = ItemPrefab.Find(null, "oxygentank"); ItemPrefab scooterPrefab = ItemPrefab.Find(null, "underwaterscooter"); ItemPrefab batteryPrefab = ItemPrefab.Find(null, "batterycell"); var cargoSp = WayPoint.WayPointList.Find(wp => wp.Submarine == respawnSub && wp.SpawnType == SpawnType.Cargo); for (int i = 0; i < characterInfos.Count; i++) { bool bot = i >= clients.Count; characterInfos[i].ClearCurrentOrders(); bool forceSpawnInMainSub = false; if (!bot && campaign != null) { var matchingData = campaign?.GetClientCharacterData(clients[i]); if (matchingData != null) { if (!matchingData.HasSpawned) { forceSpawnInMainSub = true; } else { ReduceCharacterSkills(characterInfos[i]); } } } var character = Character.Create(characterInfos[i], (forceSpawnInMainSub ? mainSubSpawnPoints[i] : shuttleSpawnPoints[i]).WorldPosition, characterInfos[i].Name, isRemotePlayer: !bot, hasAi: bot); character.TeamID = CharacterTeamType.Team1; character.LoadTalents(); respawnedCharacters.Add(character); if (bot) { GameServer.Log(string.Format("Respawning bot {0} as {1}", character.Info.Name, characterInfos[i].Job.Name), ServerLog.MessageType.Spawning); } else { if (GameMain.GameSession?.GameMode is MultiPlayerCampaign mpCampaign && character.Info != null) { character.Info.SetExperience(Math.Max(character.Info.ExperiencePoints, mpCampaign.GetSavedExperiencePoints(clients[i]))); mpCampaign.ClearSavedExperiencePoints(clients[i]); } //tell the respawning client they're no longer a traitor if (GameMain.Server.TraitorManager?.Traitors != null && clients[i].Character != null) { if (GameMain.Server.TraitorManager.Traitors.Any(t => t.Character == clients[i].Character)) { GameMain.Server.SendDirectChatMessage(TextManager.FormatServerMessage("TraitorRespawnMessage"), clients[i], ChatMessageType.ServerMessageBox); } } clients[i].Character = character; character.OwnerClientEndPoint = clients[i].Connection.EndPointString; character.OwnerClientName = clients[i].Name; GameServer.Log(string.Format("Respawning {0} ({1}) as {2}", GameServer.ClientLogName(clients[i]), clients[i].Connection?.EndPointString, characterInfos[i].Job.Name), ServerLog.MessageType.Spawning); } if (divingSuitPrefab != null && oxyPrefab != null && RespawnShuttle != null) { Vector2 pos = cargoSp == null ? character.Position : cargoSp.Position; if (divingSuitPrefab != null && oxyPrefab != null) { var divingSuit = new Item(divingSuitPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(divingSuit, false); respawnItems.Add(divingSuit); var oxyTank = new Item(oxyPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(oxyTank, false); divingSuit.Combine(oxyTank, user: null); respawnItems.Add(oxyTank); } if (scooterPrefab != null && batteryPrefab != null) { var scooter = new Item(scooterPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(scooter, false); var battery = new Item(batteryPrefab, pos, respawnSub); Spawner.CreateNetworkEvent(battery, false); scooter.Combine(battery, user: null); respawnItems.Add(scooter); respawnItems.Add(battery); } } var characterData = campaign?.GetClientCharacterData(clients[i]); if (characterData != null && Level.Loaded?.Type != LevelData.LevelType.Outpost && characterData.HasSpawned) { GiveRespawnPenaltyAffliction(character); } if (characterData == null || characterData.HasSpawned) { //give the character the items they would've gotten if they had spawned in the main sub character.GiveJobItems(mainSubSpawnPoints[i]); if (campaign != null) { characterData = campaign.SetClientCharacterData(clients[i]); characterData.HasSpawned = true; } } else { if (characterData.HasItemData) { characterData.SpawnInventoryItems(character, character.Inventory); } else { character.GiveJobItems(mainSubSpawnPoints[i]); } characterData.ApplyHealthData(character); character.GiveIdCardTags(mainSubSpawnPoints[i]); characterData.HasSpawned = true; } //add the ID card tags they should've gotten when spawning in the shuttle foreach (Item item in character.Inventory.AllItems.Distinct()) { if (item.Prefab.Identifier != "idcard") { continue; } foreach (string s in shuttleSpawnPoints[i].IdCardTags) { item.AddTag(s); } if (!string.IsNullOrWhiteSpace(shuttleSpawnPoints[i].IdCardDesc)) { item.Description = shuttleSpawnPoints[i].IdCardDesc; } } } }
void Update() { if (WaterwheelPlayerCtrl.IsTestShootCartoon) { return; } CheckPlayerForwardHit(); CheckPlayerForwardVal(); AddPlayerMoveSpeed(); if (firing) { if (!StartBtCtrl.GetInstanceP2().CheckIsActivePlayer()) { OnStopFire(); return; } if (Time.time > lastFireTime + 1 / frequency) { if (Network.peerType != NetworkPeerType.Disconnected) { int PosX_1 = (int)(608f * (1f - CenterPerPx)); int PosX_2 = (int)(608f * (1f + CenterPerPx)); float crossPx = pcvr.CrossPosition.x; if (crossPx < PosX_1) { if (!FireLeft) { FireLeft = true; FireRight = false; NetView.RPC("SendUpdateZhuJiaoNvFireAction", RPCMode.OthersBuffered, pcvr.CrossPosition.x); } } else if (crossPx > PosX_2) { if (!FireRight) { FireLeft = false; FireRight = true; NetView.RPC("SendUpdateZhuJiaoNvFireAction", RPCMode.OthersBuffered, pcvr.CrossPosition.x); } } else { if (FireRight || FireLeft) { FireLeft = false; FireRight = false; NetView.RPC("SendUpdateZhuJiaoNvFireAction", RPCMode.OthersBuffered, pcvr.CrossPosition.x); } } } // Spawn visual bullet Vector3 mousePosInput = Input.mousePosition; if (pcvr.bIsHardWare) { mousePosInput = pcvr.CrossPosition; } Vector3 mousePos = mousePosInput + Vector3.forward * 30f; Vector3 posTmp = Camera.main.ScreenToWorldPoint(mousePos); Vector3 AmmoSpawnPos = spawnPoint.position; Vector3 AmmoForward = Vector3.Normalize(posTmp - AmmoSpawnPos); Ray ray = Camera.main.ScreenPointToRay(mousePosInput); RaycastHit hit; if (Physics.Raycast(ray, out hit, 500.0f, TerrainLayer.value)) { AmmoForward = Vector3.Normalize(hit.point - AmmoSpawnPos); } Vector3 forwardVal = AmmoForward; GameObject go = null; if (GlobalData.GetInstance().IsActiveJuLiFu) { go = (GameObject)Spawner.Spawn(bulletPrefab, AmmoSpawnPos, forwardVal); pcvr.ShuiBengState = PcvrShuiBengState.Level_1; } else { go = (GameObject)Spawner.Spawn(bulletPrefab, AmmoSpawnPos, forwardVal); pcvr.ShuiBengState = PcvrShuiBengState.Level_1; } PlayerSimpleBullet bullet = go.GetComponent <PlayerSimpleBullet> (); bullet.SetIsHandleBullet(); lastFireTime = Time.time; // Find the object hit by the raycast RaycastHit hitInfo = GetHitInfo(AmmoSpawnPos, forwardVal); if (hitInfo.transform != null) { // Get the health component of the target if any NpcHealthCtrl targetHealth = hitInfo.transform.GetComponent <NpcHealthCtrl>(); if (hitInfo.distance < 500f) { if (targetHealth) { // Apply damage if (!GlobalData.GetInstance().IsActiveJuLiFu) { targetHealth.OnDamage(2f / frequency); } else { targetHealth.OnDamage(1f / frequency); } } } bullet.dist = hitInfo.distance; // Get the rigidbody if any if (hitInfo.rigidbody != null && !hitInfo.rigidbody.isKinematic && hitInfo.rigidbody.useGravity && targetHealth != null) { // Apply force to the target object at the position of the hit point Vector3 force = PlayerTran.forward * (forcePerSecond / frequency); hitInfo.rigidbody.AddForceAtPosition(force, hitInfo.point, ForceMode.Impulse); bullet.dist = hitInfo.distance; } } else { bullet.dist = 1000; } } } }
/// <summary> /// Performs the custom Inspector. /// </summary> public override void OnInspectorGUI() { spawn = (Spawner)target; showUnitSection = EditorGUILayout.Foldout(showUnitSection, "Assign Units"); if (showUnitSection) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Easy"); spawn.unitList[0] = (GameObject)EditorGUILayout.ObjectField(spawn.unitList[0], typeof(GameObject), false); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Medium"); spawn.unitList[1] = (GameObject)EditorGUILayout.ObjectField(spawn.unitList[1], typeof(GameObject), false); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Hard"); spawn.unitList[2] = (GameObject)EditorGUILayout.ObjectField(spawn.unitList[2], typeof(GameObject), false); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Boss"); spawn.unitList[3] = (GameObject)EditorGUILayout.ObjectField(spawn.unitList[3], typeof(GameObject), false); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); showWaveSection = EditorGUILayout.Foldout(showWaveSection, "Set Waves"); if (showWaveSection) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.BeginVertical(GUILayout.MinWidth(150)); { GUILayout.Label("Unit Level"); GUILayout.Label("Number of Units"); GUILayout.Label("Spawn Type"); GUILayout.Label("Time Between Spawn"); switch (spawn.spawnType) { case SpawnModes.TimedWave: case SpawnModes.TimeSplitWave: GUILayout.Label("Wave Timer"); goto case SpawnModes.Wave; case SpawnModes.Wave: GUILayout.Label("Number of Waves"); break; default: break; } } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GUILayout.MinWidth(80)); { spawn.unitLevel = (UnitLevels)EditorGUILayout.EnumPopup(spawn.unitLevel); spawn.totalUnits = EditorGUILayout.IntField(spawn.totalUnits); spawn.spawnType = (SpawnModes)EditorGUILayout.EnumPopup(spawn.spawnType); spawn.timeBetweenSpawns = EditorGUILayout.FloatField(spawn.timeBetweenSpawns); switch (spawn.spawnType) { case SpawnModes.TimedWave: case SpawnModes.TimeSplitWave: spawn.waveTimer = EditorGUILayout.FloatField(spawn.waveTimer); goto case SpawnModes.Wave; case SpawnModes.Wave: spawn.totalWaves = EditorGUILayout.IntField(spawn.totalWaves); break; default: break; } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.PrefixLabel("Spawner ID"); spawn.spawnID = EditorGUILayout.IntField(spawn.spawnID); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.PrefixLabel("Spawn Location"); spawn.spawnLocation = (Transform)EditorGUILayout.ObjectField(spawn.spawnLocation, typeof(Transform), true); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.PrefixLabel("Spawn"); spawn.spawn = EditorGUILayout.Toggle(spawn.spawn); } EditorGUILayout.EndHorizontal(); if (GUI.changed) { EditorUtility.SetDirty(target); } }
void Awake() { floor = GameObject.Find("Foreground"); spawner = GameObject.Find("Spawner").GetComponent <Spawner>(); timeManager = GetComponent <TimeManager>(); }
private void Awake() { spawner = GetComponent <Spawner>(); }
void Awake() { instance = this; }
public void SetUp() { ; spawner = new GameObject("Spawner").AddComponent <Spawner>(); }
// Start is called before the first frame update void Start() { spawner = GameObject.FindObjectOfType <Spawner>(); }
private void Start() { spawner = (Spawner)FindObjectOfType <Spawner>(); }
private void Awake() { S = this; boids = new List <Boid>(); InstantiateBoid(); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 0: { from.CloseGump(typeof(StartStopMontorilsh)); from.SendGump(new CityInvasion(from)); break; } case 1: { Point3D loc = new Point3D(568, 1311, 0); WayPoint point = new WayPoint(); WayPoint point1 = new WayPoint(); WayPoint point2 = new WayPoint(); //WayPoint point3 = new WayPoint(); point.Name = "MontorInvasionIlshenar"; point1.Name = "MontorInvasionIlshenar"; point2.Name = "MontorInvasionIlshenar"; Spawner spawner1 = new Spawner(1, 1440, 1441, 0, 6, "OrcBrute"); spawner1.MoveToWorld(new Point3D(950, 284, -90), Map.Malas); spawner1.WayPoint = point; point.MoveToWorld(new Point3D(950, 265, -90), Map.Malas); point.NextPoint = point2; point2.MoveToWorld(new Point3D(950, 275, -90), Map.Malas); spawner1.Name = "MontorInvasionIlshenar"; spawner1.Respawn(); Spawner spawner2 = new Spawner(1, 1440, 1441, 0, 6, "OrcBomber"); spawner2.MoveToWorld(new Point3D(952, 284, -90), Map.Malas); spawner2.WayPoint = point1; point1.MoveToWorld(new Point3D(952, 265, -90), Map.Malas); spawner2.Name = "MontorInvasionIlshenar"; spawner2.Respawn(); Spawner spawner3 = new Spawner(1, 1440, 1441, 0, 6, "Savage"); spawner3.MoveToWorld(new Point3D(950, 244, -90), Map.Malas); spawner3.WayPoint = point; spawner3.Name = "MontorInvasionIlshenar"; spawner3.Respawn(); Spawner spawner4 = new Spawner(1, 1440, 1441, 0, 6, "SavageRider"); spawner4.MoveToWorld(new Point3D(952, 244, -90), Map.Malas); spawner4.WayPoint = point1; spawner4.Name = "MontorInvasionIlshenar"; spawner4.Respawn(); World.Broadcast(33, true, "Montor Ilshenar is under invasion."); from.SendGump(new CityInvasion(from)); break; } case 2: { MontorInvasionStone monilsh = new MontorInvasionStone(); monilsh.StopMontorIlshenar(); World.Broadcast(33, true, "Montor Ilshenar's invasion was successfully beaten back. No more invaders are left in the city."); from.SendGump(new CityInvasion(from)); break; } } }
// Update is called once per frame void FixedUpdate() { timer = GameObject.Find("CountDown").GetComponent <Timer>(); spawner = GameObject.Find("Spawner").GetComponent <Spawner>(); timeStart = timer.getFlagStart(); if (timeStart) { if (!shock) { if (!arrested) { if (meleeHit) { DropCoins(); rb.AddForce(new Vector2(hAxisDash * speedDash, vAxisDash * speedDash), ForceMode2D.Impulse); } // Get direction vectors hAxis = Input.GetAxis(horizontal); vAxis = Input.GetAxis(vertical); // if there is movement to apply // then we have to check in what direction if (hAxis != 0.0f || vAxis != 0.0f) { Vector3 dir = new Vector3(hAxis, vAxis); indicator.rotation = Quaternion.LookRotation(Vector3.forward, -dir); // check if direction is between A and B (right) if (Vector3.Dot(Vector3.Cross(A, dir), Vector3.Cross(A, B)) >= 0 && Vector3.Dot(Vector3.Cross(B, dir), Vector3.Cross(B, A)) >= 0) { animator.ResetTrigger(currentAnimation); currentAnimation = "MoveLeft"; animator.SetTrigger(currentAnimation); GetComponent <SpriteRenderer>().flipX = true; } // check if direction is between C and D (left) else if (Vector3.Dot(Vector3.Cross(C, dir), Vector3.Cross(C, D)) >= 0 && Vector3.Dot(Vector3.Cross(D, dir), Vector3.Cross(D, C)) >= 0) { animator.ResetTrigger(currentAnimation); currentAnimation = "MoveLeft"; animator.SetTrigger(currentAnimation); GetComponent <SpriteRenderer>().flipX = false; } // check if direction is between D and A (up) else if (Vector3.Dot(Vector3.Cross(D, dir), Vector3.Cross(D, A)) >= 0 && Vector3.Dot(Vector3.Cross(A, dir), Vector3.Cross(A, D)) >= 0) { animator.ResetTrigger(currentAnimation); currentAnimation = "MoveUp"; animator.SetTrigger(currentAnimation); GetComponent <SpriteRenderer>().flipX = false; } // check if direction is between B and C (down) else if (Vector3.Dot(Vector3.Cross(B, dir), Vector3.Cross(B, C)) >= 0 && Vector3.Dot(Vector3.Cross(C, dir), Vector3.Cross(C, B)) >= 0) { animator.ResetTrigger(currentAnimation); currentAnimation = "MoveDown"; animator.SetTrigger(currentAnimation); GetComponent <SpriteRenderer>().flipX = false; } // Check if player wants to shoot, if it has enough coins and fire rate if (Input.GetButtonDown(X_button)) { if (abilityX.checksCondition(this)) { SIS.Instance.CoinTossed(nPlayer); abilityX.doAction(this); animator.SetTrigger("Throw"); } } // Check if player wants to melee if (Input.GetButton(A_button)) { if (abilityA.checksCondition(this)) { SIS.Instance.MeleeThrown(nPlayer); abilityA.doAction(this); rb.AddForce(new Vector2(hAxis * speedDash, vAxis * speedDash), ForceMode2D.Impulse); animator.SetTrigger("Melee"); } } if (Input.GetButton(Y_button) || timeBasedY) { if (abilityY.checksCondition(this)) { timeBasedY = abilityY.doAction(this); } } if (Input.GetButton(B_button) || timeBasedB) { if (abilityB.checksCondition(this)) { timeBasedB = abilityB.doAction(this); } } rb.AddForce(new Vector2(hAxis * speed, vAxis * speed), ForceMode2D.Impulse); } else { animator.ResetTrigger(currentAnimation); currentAnimation = "Idle"; animator.SetTrigger(currentAnimation); GetComponent <SpriteRenderer>().flipX = false; indicator.rotation = Quaternion.LookRotation(Vector3.forward, Vector3.up); } } } } }
private void RemoveObject(GameObject ThisObject) { Spawner.CacheDestroy(ThisObject); }
public float actionDelay = .2f; // Delay on a repeating action when holding down a key void Start() { managerInstance = gameObject.GetComponent <GameStateManager>(); spawnerInstance = gameObject.GetComponent <Spawner>(); }
void Start() { spawner = FindObjectOfType <Spawner>(); spawnXThreshold = spawner.transform.position.x; }
private void Awake() { //GameStarter = GameObject.Find("GameStarter").GetComponent<GameStarter>(); _spawner = Spawner.Instance; }
public QueuedSpawn(IEnumerator <ISpawned> spawner, Spawner spawnType) { Spawns = spawner; SpawnType = spawnType; }
void Start() { _rigidBody = GetComponent <Rigidbody2D>(); _jumpParticles = GetComponent <Spawner>(); }
void Start() { spawner = GetComponent <Spawner>(); }
public void Update(float deltaTime) { //if (PlayerInput.KeyHit(InputType.Crouch) && (this == MainSub)) FlipX(); if (Level.Loaded == null || subBody == null) { return; } if (WorldPosition.Y < Level.MaxEntityDepth && subBody.Body.Enabled && (GameMain.NetworkMember?.RespawnManager == null || this != GameMain.NetworkMember.RespawnManager.RespawnShuttle)) { subBody.Body.ResetDynamics(); subBody.Body.Enabled = false; foreach (MapEntity e in MapEntity.mapEntityList) { if (e.Submarine == this) { Spawner.AddToRemoveQueue(e); } } foreach (Character c in Character.CharacterList) { if (c.Submarine == this) { c.Kill(CauseOfDeath.Pressure); c.Enabled = false; } } return; } subBody.Body.LinearVelocity = new Vector2( LockX ? 0.0f : subBody.Body.LinearVelocity.X, LockY ? 0.0f : subBody.Body.LinearVelocity.Y); subBody.Update(deltaTime); for (int i = 0; i < 2; i++) { if (MainSubs[i] == null) { continue; } if (this != MainSubs[i] && MainSubs[i].DockedTo.Contains(this)) { return; } } //send updates more frequently if moving fast networkUpdateTimer -= MathHelper.Clamp(Velocity.Length() * 10.0f, 0.1f, 5.0f) * deltaTime; if (networkUpdateTimer < 0.0f) { networkUpdateTimer = 1.0f; } }
/// <summary> /// Removes a spawn type immediately. Note that it's easier to /// just set DestroyQueued to true on an spawner. /// </summary> public void RemoveSpawnType(Spawner spawner) { spawnTypes.Remove(spawner); }
private void Awake() { spawner = FindObjectOfType <Spawner>(); spawner.OnNewWave += OnNewWave; }
/** Flammer spawnes */ public void blastHallWithFire() { Spawner sp = gameObject.GetComponent <Spawner> (); Vector3 bombPos = transform.position; GameObject senesteFlamme; // Retninger Vector3 opVecDec = new Vector3(270, 0, 0); Vector3 nedVecDec = new Vector3(90, 180, 0); Vector3 hoejreVecDec = new Vector3(0, 90, 270); Vector3 venstreVecDec = new Vector3(0, 270, 90); // Center senesteFlamme = sp.SpawnElement(bombPos, opVecDec); senesteFlamme.GetComponent <Exploded> ().placer = placer; // Mid & End bool up = true; bool down = true; bool left = true; bool right = true; for (float i = 0; i <= range; i++) { /* Hvis enden er nået sættes element til at være flammeEnd * ellers sættes den til at være flammeMid */ int element = i < range ? 1 : 2; if (up) { senesteFlamme = sp.SpawnElement(bombPos + new Vector3(0, i, 0), opVecDec, element); senesteFlamme.GetComponent <Exploded> ().placer = placer; char ramte = ForbiddenTilesVores.CheckSquare(senesteFlamme.transform.position + new Vector3(0, 1, 0)); up = setFalseAndDestroy(senesteFlamme, ramte, up); } if (down) { senesteFlamme = sp.SpawnElement(bombPos + new Vector3(0, -i, 0), nedVecDec, element); senesteFlamme.GetComponent <Exploded> ().placer = placer; char ramte = ForbiddenTilesVores.CheckSquare(senesteFlamme.transform.position + new Vector3(0, -1, 0)); down = setFalseAndDestroy(senesteFlamme, ramte, down); } if (right) { senesteFlamme = sp.SpawnElement(bombPos + new Vector3(i, 0, 0), hoejreVecDec, element); senesteFlamme.GetComponent <Exploded> ().placer = placer; char ramte = ForbiddenTilesVores.CheckSquare(senesteFlamme.transform.position + new Vector3(1, 0, 0)); right = setFalseAndDestroy(senesteFlamme, ramte, right); } if (left) { senesteFlamme = sp.SpawnElement(bombPos + new Vector3(-i, 0, 0), venstreVecDec, element); senesteFlamme.GetComponent <Exploded> ().placer = placer; char ramte = ForbiddenTilesVores.CheckSquare(senesteFlamme.transform.position + new Vector3(-1, 0, 0)); left = setFalseAndDestroy(senesteFlamme, ramte, left); } } }
void Start() { Instance = this; }
private void Awake() { spawner = FindObjectOfType <Spawner>(); aiStateMachine = FindObjectOfType <AIStateMachine>(); }