void Awake() { // Get a reference to the current arena. arena = GameObject.FindGameObjectWithTag("Arena"); if (arena != null) { arenaController = arena.GetComponent <ArenaController>(); } else { Debug.LogError("Unable to find GameObject with tag Arena in this scene. Please add an arena, jeez."); } // Grab ref to HordeManager GameObject horde = GameObject.FindGameObjectWithTag("HordeManager"); if (horde != null) { hordeManager = horde.GetComponent <HordeManager>(); } else { Debug.LogError("Unable to find GameObject with tag HordeManager in this scene. Please add some enemies, jeez."); } // Instantiate the avatar for the localplayer. GameObject lp = Instantiate(localPlayerPrefab, Vector3.zero, Quaternion.identity) as GameObject; localPlayerController = lp.GetComponent <PlayerController>(); localPlayerController.state = currentPlayerState; // Mark the time state.startTime = Time.time; }
private ChunkTask GetChunkTask(ArenaController arena, ChunkType type) { switch (type) { case ChunkType.Fighting: return(new FightingTask(() => this.enemies)); case ChunkType.Mining: return(new MiningTask(() => this.miningSpots)); case ChunkType.Fishing: return(new FishingTask(() => this.fishingSpots)); case ChunkType.Woodcutting: return(new WoodcuttingTask(() => this.trees)); case ChunkType.Crafting: return(new CraftingTask(() => this.craftingStations.Where(x => x.StationType == CraftingStationType.Crafting).ToList())); case ChunkType.Farming: return(new FarmingTask(() => this.farmingPatches)); case ChunkType.Cooking: return(new CookingTask(() => this.craftingStations.Where(x => x.StationType == CraftingStationType.Cooking).ToList())); //case ChunkType.Arena: return new ArenaTask(arena); default: return(null); } }
// Start is called before the first frame update void Start() { _lastSpawn = 0; _arenaManager = _arena.GetComponent <ArenaController>(); _lastRingRadius = _arenaManager.GetCurrentRingRadius(); }
void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "Player") { if (coll.collider.GetComponent <Player>().isCheating) { return; } // stop boss ArenaController arena = GameObject.FindGameObjectWithTag("Generator").GetComponent <ArenaController>(); // arena.enabled = false; arena.Boss.transform.parent = arena.BossPipeLine.transform; GameObject.Find("Player").GetComponent <Player>().inAir = true; GameObject.Find("Player").GetComponent <Player>().isFighting = false; GameObject.FindGameObjectWithTag("Generator").GetComponent <Menu>().killedBy = "Boss"; // GameObject.FindGameObjectWithTag("PipeLine").GetComponent<PipeLine>().pipes[0].LeftPipe.GetComponent<PlayerKiller>().OnTriggerEnter2D(coll); Debug.Log("Axe is calling playerkiller"); GameObject.FindGameObjectWithTag("PipeLine").GetComponent <PipeLine>().pipes[0].LeftPipe.GetComponent <PlayerKiller>().OnTriggerEnter2D(coll.collider.gameObject.GetComponent <BoxCollider2D>()); Destroy(this.gameObject); } Debug.Log("Axe collidied!"); }
static void Main(string[] args) { ArenaController controller = new ArenaController(); Engine engine = new Engine(controller); engine.Run(); }
// Start is called before the first frame update void Start() { if (!settings) { settings = GetComponent <GameSettings>(); } if (!subEventManager) { subEventManager = GetComponent <TwitchSubscribeEventManager>(); } if (!subEventManager) { subEventManager = gameObject.AddComponent <TwitchSubscribeEventManager>(); } commandServer = GetComponent <CommandServer>(); itemManager = GetComponent <ItemManager>(); playerManager = GetComponent <PlayerManager>(); chunkManager = GetComponent <ChunkManager>(); craftingManager = GetComponent <CraftingManager>(); raidManager = GetComponent <RaidManager>(); arenaController = FindObjectOfType <ArenaController>(); commandServer.StartServer(this); }
private void SetInstance() { if (!m_instance) { m_instance = this; } }
protected override void UpdateInput() { input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); //andar somente em uma direção float x = Mathf.Abs(input.x); float y = Mathf.Abs(input.y); if (x + y > 1f) { input.y = 0f; } if (input.sqrMagnitude > 0) { LookingDirection = input; } if (Input.GetButtonUp("Jump")) { Vector2 pos = ArenaController.GetTilePosition(ArenaPoint); ArenaController.Instance.InstanciateBomb(pos, BoundingBox); } if (Input.GetButtonUp("Fire2")) { Vector2 pos = ArenaController.GetTilePosition(ArenaPoint); ArenaController.Instance.InstanciateExplosion(pos); } }
protected override void PlaceTiled() { Point p = ArenaController.GetTilePoint(BoxCenterPosition); transform.position = new Vector2(p.x * ArenaController.HORIZONTAL_SIZE + ArenaController.HORIZONTAL_SIZE / 2f, p.y * ArenaController.VERTICAL_SIZE - ArenaController.VERTICAL_SIZE); }
private void OnTriggerEnter2D(Collider2D other) { if (other.tag == "Attack") { ArenaController.GetInstance().KillEnemy(enemyBehaviour); Destroy(this.transform.parent.gameObject); } }
public static void SaveGame(GameData gameData, ArenaController arenaController) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(path, FileMode.Create); GameInfo gameInfo = new GameInfo(gameData, arenaController); formatter.Serialize(stream, gameInfo); stream.Close(); }
public void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag == "Player") { Debug.Log("watch your head!"); player = other.gameObject.GetComponent <Player>(); if (player.isCheating) { return; } player.die(); PipeLineGenerator pgn = GameObject.FindGameObjectWithTag("Generator").GetComponent <PipeLineGenerator>(); pls = GameObject.FindGameObjectsWithTag("PipeLine"); ArenaController arena = GameObject.FindGameObjectWithTag("Generator").GetComponent <ArenaController>(); arena.enabled = false; pgn.enabled = false; GameObject.Find("Clouds").GetComponent <CloudMover>().enabled = false; pgn.Start(); AirLevel = pgn.AirLevel; levelPos = pgn.AirLevel.transform.position.y; GameObject.Find("Clouds").transform.parent = AirLevel.transform; if (AirLevel.GetComponent <Animation>().isPlaying) { AirLevel.GetComponent <Animation>().Stop(); } foreach (GameObject pl in pls) { PipeLine p = pl.GetComponent <PipeLine>(); p.transform.parent = AirLevel.transform; p.enabled = false; foreach (PipePair pair in p.pipes) { if (pair.firstPipeInGame) { p.transform.parent = null; } else { pair.enabled = false; } } } isDying = true; } }
void Start() { arenaController = GameObject.Find("Arena").gameObject.GetComponent <ArenaController>(); size = Directory.GetFiles(currentDirectory + @"\soundFiles", "*.wav").Length; string[] soundFiles = new string[size]; soundFiles = Directory.GetFiles(currentDirectory + @"\soundFiles", "*.wav"); for (int i = 0; i < size; i++) { files.Add(soundFiles[i]); } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); //Version 0 if (version >= 0) { m_ArenaController = reader.ReadItem() as ArenaController; } //----- m_Instances.Add(this); }
void Start() { controller = new ArenaController(this); _rewardItems = new Dictionary <int, int>(); _rewardItems[59] = 1; _rewardItems[60] = 2; _rewardItems[61] = 3; _userTopList = new List <UIUserTopManager>(); _curPage = 1; _maxObjPerPage = 8; controller.SendRequestTopList(); controller.SendRequestReportList(); ShowInforUser(); ShowItemReward(); }
public override void _Ready() { base._Ready(); // Assign nodes/components Arena = GameController.GetNode <ArenaController>("Arena"); AggroRange = GetNode <Area2D>("AggroRange"); AggroTime = GetNode <Timer>("AggroTime"); AttackRange = GetNode <Area2D>("AttackRange"); AttackRate = GetNode <Timer>("AttackRate"); AttackRate.WaitTime = (60 / _attacksPerSeconds) / 60; Stats.SetValue(StatTypes.MHP, 20, false); Stats.SetValue(StatTypes.HP, Stats[StatTypes.MHP], false); Stats.SetValue(StatTypes.EXP, 10000, false); StateMachine.ChangeState <EnemyIdleState>(StateTypes.Enemy); }
public void TestMethod02() { // Input var inputReader = new StreamReader("tests/02.in"); var inputText = inputReader.ReadToEnd(); // Output var outputReader = new StreamReader("tests/02.out"); var outputText = outputReader.ReadToEnd(); // Execute ArenaController arenaController = new ArenaController(); EngineTest engine = new EngineTest(arenaController); var messageText = engine.Test(inputText); // Test Assert.AreEqual(outputText, messageText); }
public void Die() { ++Statistics.DeathCount; if (!arena) { arena = FindObjectOfType <ArenaController>(); } if (arena) { arena.Died(this); } if (duelHandler.InDuel) { duelHandler.Died(); } InCombat = false; PlayDeathAnimation(); Lock(); StartCoroutine(Respawn()); }
public override void OnClick() { PlayerMobile player = m_From as PlayerMobile; if (player == null) { return; } if (ArenaController.GetArenaAtLocation(player.Location, player.Map) != null) { player.SendMessage("You cannot access stables while at that location."); return; } player.CloseGump(typeof(StableGump)); player.SendGump(new StableGump(m_Vendor, player, 0)); player.SendSound(0x055); }
public void SetUp() { _arenaServiceMock = new Mock <IArenaService>(); _arenaController = new ArenaController(_arenaServiceMock.Object); _user1 = new User("user1", "supergeheim"); _user2 = new User("user2", "secretsecret"); _arena = new Arena(_user1, _user2); _pack = new List <Card> { new Wizard("wizgan", "Gandalf", 100, ElementType.Normal), new Orc("orcbur", "Burul", 80, ElementType.Normal), new Elve("elverl", "Erlan Erhice", 50, ElementType.Fire), new Dragon("drabal", "Balrog", 150, ElementType.Water), new WaterSpell("watwat", "Water Whirl", 70) }; _package = new CardPackage(); foreach (var card in _pack) { _package.AddCard(card); } }
public override void OnSpeech(SpeechEventArgs e) { PlayerMobile player = e.Mobile as PlayerMobile; if (player == null) { return; } string text = e.Speech.Trim().ToLower(); if (player.Alive) { if (text.IndexOf("house") != -1 || text.IndexOf("housing") != -1 || text.IndexOf("claim") != -1 || text.IndexOf("stable") != -1) { e.Handled = true; if (ArenaController.GetArenaAtLocation(player.Location, player.Map) != null) { player.SendMessage("You cannot access stables while at that location."); return; } player.CloseGump(typeof(StableGump)); player.SendGump(new StableGump(this, player, 0)); player.SendSound(0x055); return; } } else { base.OnSpeech(e); } }
// Start is called before the first frame update void Start() { if (!dropEventManager) { dropEventManager = GetComponent <DropEventManager>(); } if (!ferryProgress) { ferryProgress = FindObjectOfType <FerryProgress>(); } if (!gameCamera) { gameCamera = FindObjectOfType <GameCamera>(); } if (!playerLogoManager) { playerLogoManager = GetComponent <PlayerLogoManager>(); } if (!villageManager) { villageManager = FindObjectOfType <VillageManager>(); } if (!settings) { settings = GetComponent <GameSettings>(); } if (!subEventManager) { subEventManager = GetComponent <TwitchEventManager>(); } if (!subEventManager) { subEventManager = gameObject.AddComponent <TwitchEventManager>(); } if (!commandServer) { commandServer = GetComponent <CommandServer>(); } if (!islandManager) { islandManager = GetComponent <IslandManager>(); } if (!itemManager) { itemManager = GetComponent <ItemManager>(); } if (!playerManager) { playerManager = GetComponent <PlayerManager>(); } if (!chunkManager) { chunkManager = GetComponent <ChunkManager>(); } if (!craftingManager) { craftingManager = GetComponent <CraftingManager>(); } if (!raidManager) { raidManager = GetComponent <RaidManager>(); } if (!streamRaidManager) { streamRaidManager = GetComponent <StreamRaidManager>(); } if (!arenaController) { arenaController = FindObjectOfType <ArenaController>(); } if (!ferryController) { ferryController = FindObjectOfType <FerryController>(); } if (!musicManager) { musicManager = GetComponent <MusicManager>(); } RegisterGameEventHandler <ItemAddEventHandler>(GameEventType.ItemAdd); RegisterGameEventHandler <ResourceUpdateEventHandler>(GameEventType.ResourceUpdate); RegisterGameEventHandler <ServerMessageEventHandler>(GameEventType.ServerMessage); RegisterGameEventHandler <VillageInfoEventHandler>(GameEventType.VillageInfo); RegisterGameEventHandler <VillageLevelUpEventHandler>(GameEventType.VillageLevelUp); RegisterGameEventHandler <PlayerRemoveEventHandler>(GameEventType.PlayerRemove); RegisterGameEventHandler <PlayerAddEventHandler>(GameEventType.PlayerAdd); RegisterGameEventHandler <PlayerExpUpdateEventHandler>(GameEventType.PlayerExpUpdate); RegisterGameEventHandler <PlayerJoinArenaEventHandler>(GameEventType.PlayerJoinArena); RegisterGameEventHandler <PlayerJoinDungeonEventHandler>(GameEventType.PlayerJoinDungeon); RegisterGameEventHandler <PlayerJoinRaidEventHandler>(GameEventType.PlayerJoinRaid); RegisterGameEventHandler <PlayerNameUpdateEventHandler>(GameEventType.PlayerNameUpdate); RegisterGameEventHandler <PlayerTaskEventHandler>(GameEventType.PlayerTask); RegisterGameEventHandler <StreamerWarRaidEventHandler>(GameEventType.WarRaid); RegisterGameEventHandler <StreamerRaidEventHandler>(GameEventType.Raid); RegisterGameEventHandler <PlayerAppearanceEventHandler>(GameEventType.PlayerAppearance); RegisterGameEventHandler <ItemBuyEventHandler>(GameEventType.ItemBuy); RegisterGameEventHandler <ItemSellEventHandler>(GameEventType.ItemSell); commandServer.StartServer(this); musicManager.PlayBackgroundMusic(); }
// Start is called before the first frame update void Start() { if (!dropEventManager) { dropEventManager = GetComponent <DropEventManager>(); } if (!ferryProgress) { ferryProgress = FindObjectOfType <FerryProgress>(); } if (!gameCamera) { gameCamera = FindObjectOfType <GameCamera>(); } if (!settings) { settings = GetComponent <GameSettings>(); } if (!subEventManager) { subEventManager = GetComponent <TwitchEventManager>(); } if (!subEventManager) { subEventManager = gameObject.AddComponent <TwitchEventManager>(); } if (!commandServer) { commandServer = GetComponent <CommandServer>(); } if (!islandManager) { islandManager = GetComponent <IslandManager>(); } if (!itemManager) { itemManager = GetComponent <ItemManager>(); } if (!playerManager) { playerManager = GetComponent <PlayerManager>(); } if (!chunkManager) { chunkManager = GetComponent <ChunkManager>(); } if (!craftingManager) { craftingManager = GetComponent <CraftingManager>(); } if (!raidManager) { raidManager = GetComponent <RaidManager>(); } if (!streamRaidManager) { streamRaidManager = GetComponent <StreamRaidManager>(); } if (!arenaController) { arenaController = FindObjectOfType <ArenaController>(); } if (!ferryController) { ferryController = FindObjectOfType <FerryController>(); } if (!musicManager) { musicManager = GetComponent <MusicManager>(); } commandServer.StartServer(this); musicManager.PlayBackgroundMusic(); }
// Start is called before the first frame update void Start() { cam = Camera.main; rb = GetComponent <Rigidbody2D>(); arenaController = GameObject.Find("Arena").GetComponent <ArenaController>(); }
public ArenaTask(ArenaController arena) { this.arena = arena; }
void Start() { arenaController = GameObject.Find("Arena").GetComponent <ArenaController>(); }
public int currentScore = 999; // score in current game public GameInfo(GameData gameData, ArenaController arenaController) { this.highScore = arenaController.score > gameData.highScore ? arenaController.score : gameData.highScore; this.lastScore = arenaController.score; }
public static int DetermineMobileNotoriety(Mobile source, Mobile target, bool useVengeance) { BaseCreature bc_Source = source as BaseCreature; PlayerMobile pm_Source = source as PlayerMobile; Mobile m_SourceController = null; BaseCreature bc_SourceController = null; PlayerMobile pm_SourceController = null; BaseCreature bc_Target = target as BaseCreature; PlayerMobile pm_Target = target as PlayerMobile; Mobile m_TargetController = null; BaseCreature bc_TargetController = null; PlayerMobile pm_TargetController = null; if (bc_Source != null) { m_SourceController = bc_Source.ControlMaster as Mobile; bc_SourceController = bc_Source.ControlMaster as BaseCreature; pm_SourceController = bc_Source.ControlMaster as PlayerMobile; } if (bc_Target != null) { m_TargetController = bc_Target.ControlMaster as Mobile; bc_TargetController = bc_Target.ControlMaster as BaseCreature; pm_TargetController = bc_Target.ControlMaster as PlayerMobile; } ArenaController fromArenaController = ArenaController.GetArenaAtLocation(source.Location, source.Map); ArenaController targetArenaController = ArenaController.GetArenaAtLocation(target.Location, target.Map); if (fromArenaController != null && targetArenaController != null && fromArenaController == targetArenaController) { if (fromArenaController.m_ArenaFight != null) { if (fromArenaController.m_ArenaFight.m_FightPhase == ArenaFight.FightPhaseType.Fight) { if (fromArenaController.m_ArenaFight.m_ArenaMatch != null) { ArenaMatch arenaMatch = fromArenaController.m_ArenaFight.m_ArenaMatch; if (ArenaMatch.IsValidArenaMatch(arenaMatch, null, false)) { PlayerMobile rootPlayerFrom = null; PlayerMobile rootPlayerTarget = null; if (pm_Source != null) { rootPlayerFrom = pm_Source; } if (pm_Target != null) { rootPlayerTarget = pm_Target; } if (pm_SourceController != null) { rootPlayerFrom = pm_SourceController; } if (pm_TargetController != null) { rootPlayerTarget = pm_TargetController; } ArenaParticipant fromArenaParticipant = fromArenaController.m_ArenaFight.m_ArenaMatch.GetParticipant(rootPlayerFrom); ArenaParticipant targetArenaParticipant = fromArenaController.m_ArenaFight.m_ArenaMatch.GetParticipant(rootPlayerTarget); if (fromArenaParticipant != null && targetArenaParticipant != null) { if (fromArenaParticipant.m_FightStatus == ArenaParticipant.FightStatusType.Alive && targetArenaParticipant.m_FightStatus == ArenaParticipant.FightStatusType.Alive) { ArenaTeam fromTeam = null; ArenaTeam targetTeam = null; foreach (ArenaTeam team in arenaMatch.m_Teams) { if (team == null) { continue; } if (team.Deleted) { continue; } ArenaParticipant participant = team.GetPlayerParticipant(rootPlayerFrom); if (participant != null) { fromTeam = team; } participant = team.GetPlayerParticipant(rootPlayerTarget); if (participant != null) { targetTeam = team; } } if (fromTeam != null && targetTeam != null) { if (fromTeam == targetTeam) { return(Notoriety.Ally); } if (fromTeam != targetTeam) { return(Notoriety.Enemy); } } } } } } } } } //Berserk Creatures if (bc_Source != null && (source is BladeSpirits || source is EnergyVortex)) { if (bc_Source.ControlMaster != null && pm_Target != null) { //Blade Spirits + Energy Vortexes Can Freely Attack Their Control Master Without Causing Criminal Action if (bc_Source.ControlMaster == pm_Target) { return(Notoriety.CanBeAttacked); } } if (bc_Source.ControlMaster != null && bc_Target != null) { //Blade Spirits + Energy Vortexes Can Freely Attack Other Followers Of Their Control Master Without Causing Criminal Action if (bc_Source.ControlMaster == bc_Target.ControlMaster) { return(Notoriety.CanBeAttacked); } } } if (target is BladeSpirits || target is EnergyVortex) { return(Notoriety.Murderer); } //Staff Members Always Attackable if (target.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } if (m_TargetController != null) { //Creature Controlled By Staff Member if (m_TargetController.AccessLevel > AccessLevel.Player) { return(Notoriety.CanBeAttacked); } } //Enemy of One if (pm_Source != null && bc_Target != null) { if (!bc_Target.Summoned && !bc_Target.Controlled && pm_Source.EnemyOfOneType == target.GetType()) { return(Notoriety.Enemy); } } //Justice Free Zone if (SpellHelper.InBuccs(target.Map, target.Location) || SpellHelper.InYewOrcFort(target.Map, target.Location) || SpellHelper.InYewCrypts(target.Map, target.Location)) { return(Notoriety.CanBeAttacked); } //Grey Zone Totem Nearby if (GreyZoneTotem.InGreyZoneTotemArea(target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } //Hotspot Nearby if (Custom.Hotspot.InHotspotArea(target.Location, target.Map, true)) { return(Notoriety.CanBeAttacked); } //Player Notoriety if (pm_Target != null) { //Friendly if (pm_SourceController != null) { if (pm_SourceController == pm_Target) { return(Notoriety.Ally); } } //Murderer if (pm_Target.Murderer && !pm_Target.HideMurdererStatus) { return(Notoriety.Murderer); } //Criminal if (pm_Target.Criminal) { return(Notoriety.Criminal); } //Perma-Grey if (SkillHandlers.Stealing.ClassicMode && pm_Target.PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (pm_SourceController != null) { //Target is Perma-Grey to Source Creature's Controller if (SkillHandlers.Stealing.ClassicMode && pm_Target.PermaFlags.Contains(pm_SourceController)) { return(Notoriety.CanBeAttacked); } } } //Guilds //TEST: GUILD /* * Guild sourceGuild = GetGuildFor(source.Guild as Guild, source); * Guild targetGuild = GetGuildFor(target.Guild as Guild, target); * * if (sourceGuild != null && targetGuild != null) * { * if (sourceGuild == targetGuild || sourceGuild.IsAlly(targetGuild)) * return Notoriety.Ally; * * else if (sourceGuild.IsEnemy(targetGuild)) * return Notoriety.Enemy; * } */ //Creature Notoriety if (bc_Target != null) { //Friendly if (m_TargetController != null) { //Target is Source's Controller if (source == m_TargetController) { return(Notoriety.Ally); } } if (m_SourceController != null) { //Source is Target's Controller if (m_SourceController == bc_Target) { return(Notoriety.Ally); } } //Murderer if (bc_Target.IsMurderer()) { return(Notoriety.Murderer); } if (pm_TargetController != null) { if (pm_TargetController.Murderer) { return(Notoriety.Murderer); } } if (bc_TargetController != null) { if (bc_TargetController.IsMurderer()) { return(Notoriety.Murderer); } } //Criminal if (bc_Target.Criminal) { return(Notoriety.Criminal); } if (pm_TargetController != null) { if (pm_TargetController.Criminal) { return(Notoriety.Criminal); } } if (bc_TargetController != null) { if (bc_TargetController.Criminal) { return(Notoriety.Criminal); } } //Perma-Grey if (pm_TargetController != null) { if (SkillHandlers.Stealing.ClassicMode && pm_TargetController.PermaFlags.Contains(source)) { return(Notoriety.CanBeAttacked); } if (pm_SourceController != null) { //Target is Perma-Grey to Source Creature's Controller if (SkillHandlers.Stealing.ClassicMode && pm_TargetController.PermaFlags.Contains(pm_SourceController)) { return(Notoriety.CanBeAttacked); } } } } //Housing if (CheckHouseFlag(source, target, target.Location, target.Map)) { return(Notoriety.CanBeAttacked); } //Aggressor: Source to Target if (CheckAggressor(source.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, target) && useVengeance) { return(Notoriety.CanBeAttacked); } //Aggressor: Source Controller to Target if (m_SourceController != null) { if (CheckAggressor(m_SourceController.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(m_SourceController.Aggressed, target) && useVengeance) { return(Notoriety.CanBeAttacked); } } //Aggressor: Source to Target's Controller if (m_TargetController != null) { if (CheckAggressor(source.Aggressors, m_TargetController)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(source.Aggressed, m_TargetController) && useVengeance) { return(Notoriety.CanBeAttacked); } } //Aggressor: Source Controller to Target's Controller if (m_SourceController != null && m_TargetController != null) { if (CheckAggressor(m_SourceController.Aggressors, m_TargetController)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(m_SourceController.Aggressed, m_TargetController) && useVengeance) { return(Notoriety.CanBeAttacked); } } //Player Followers: If A Player or Any of Their Followers Have been Aggressed or Barded, the Player and All Other Followers Can Attack the Aggressor PlayerMobile pm_Player = null; if (pm_Source != null) { pm_Player = pm_Source; } if (pm_SourceController != null) { pm_Player = pm_SourceController; } if (pm_Player != null) { if (pm_Player.AllFollowers.Count > 0) { //Any of the Player's Other Followers foreach (Mobile follower in pm_Player.AllFollowers) { BaseCreature bc_Follower = follower as BaseCreature; if (bc_Follower == null) { continue; } //Follower Has Been Aggressed/Aggresor to Target if (CheckAggressor(bc_Follower.Aggressors, target)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(bc_Follower.Aggressed, target) && useVengeance) { return(Notoriety.CanBeAttacked); } //Follower Has Been Aggressed/Aggresor by/to Target's Controller if (m_TargetController != null) { if (CheckAggressor(bc_Follower.Aggressors, m_TargetController)) { return(Notoriety.CanBeAttacked); } if (CheckAggressed(bc_Follower.Aggressed, m_TargetController) && useVengeance) { return(Notoriety.CanBeAttacked); } } } } } //Ships: Players and Creatures Friendly to a Ship Can Freely Attack Non-Friendly Mobiles on their Ship BaseShip sourceShip = null; if (bc_Source != null) { if (bc_Source.ShipOccupied != null) { sourceShip = bc_Source.ShipOccupied; } } if (pm_Source != null) { if (pm_Source.ShipOccupied != null) { sourceShip = pm_Source.ShipOccupied; } } if (sourceShip != null) { BaseShip targetShip = null; if (bc_Target != null) { if (bc_Target.ShipOccupied != null) { targetShip = bc_Target.ShipOccupied; } } if (pm_Target != null) { if (pm_Target.ShipOccupied != null) { targetShip = pm_Target.ShipOccupied; } } //On Same Ship if (sourceShip != null && targetShip != null && !sourceShip.Deleted && !targetShip.Deleted && sourceShip == targetShip) { bool sourceBelongs = false; bool targetBelongs = false; //Source Belongs n the Ship if (sourceShip.Crew.Contains(source) || sourceShip.IsFriend(source) || sourceShip.IsCoOwner(source) || sourceShip.IsOwner(source)) { sourceBelongs = true; } //Source's Owner Belongs on the Ship else if (bc_Source != null) { if (m_SourceController != null) { if (sourceShip.Crew.Contains(m_SourceController) || sourceShip.IsFriend(m_SourceController) || sourceShip.IsCoOwner(m_SourceController) || sourceShip.IsOwner(m_SourceController)) { sourceBelongs = true; } } } //Target Belongs On The Ship if (sourceShip.Crew.Contains(target) || sourceShip.IsFriend(target) || sourceShip.IsCoOwner(target) || sourceShip.IsOwner(target)) { targetBelongs = true; } //Target's Owner Belongs On the Ship else if (bc_Target != null) { if (m_TargetController != null) { if (sourceShip.Crew.Contains(m_TargetController) || sourceShip.IsFriend(m_TargetController) || sourceShip.IsCoOwner(m_TargetController) || sourceShip.IsOwner(m_TargetController)) { targetBelongs = true; } } } //Target May Be Freely Attacked on Ship if (sourceBelongs && !targetBelongs) { return(Notoriety.CanBeAttacked); } } } //Polymorph or Body Transformation if (!(bc_Target != null && bc_Target.InitialInnocent)) { if (target.Player && target.BodyMod > 0) { } else if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(bc_Target) && !TransformationSpellHelper.UnderTransformation(target)) { return(Notoriety.CanBeAttacked); } } //If somehow a player is attacking us with their tamed creatures, and their creatures are flagged to us but the player isn't //if (pm_Source != null && pm_Target != null) //{ // if (pm_Target.AllFollowers.Count > 0) // { // //Any of the Player's Other Followers // foreach (Mobile follower in pm_Target.AllFollowers) // { // int notorietyResult = Notoriety.Compute(source, follower); // //Enemy Tamer Adopts Notoriety of Their Creature (Anything other than Innocent) // if (notorietyResult != 1) // { // foreach(var aggressor in source.Aggressors) // { // if (aggressor.Attacker == follower) // return notorietyResult; // } // } // } // } //} return(Notoriety.Innocent); }
void Awake() { CreateEntities(); controller = this; }
public void genNewPipeLine() { GameObject newPipeline; pipeCounter++; if (pipeCounter % (firstBossAppearAfter + bossCounter * 5) == 0) { nextPLtypename = PipeLine.PipeLineType.simple; pipeCounter = 0; bossCounter++; } switch (nextPLtypename) { case PipeLine.PipeLineType.simple: newPipeline = (GameObject)Instantiate(prefab_pl_simple, new Vector3(0, 5.5f, 0), Quaternion.identity); distanceToNextPipe = 2; break; case PipeLine.PipeLineType.closing: newPipeline = (GameObject)Instantiate(prefab_pl_closing, new Vector3(0, 5.5f, 0), Quaternion.identity); distanceToNextPipe = 2; break; case PipeLine.PipeLineType.moving: newPipeline = (GameObject)Instantiate(prefab_pl_moving, new Vector3(0, 5.5f, 0), Quaternion.identity); distanceToNextPipe = 2; break; case PipeLine.PipeLineType.moving2: newPipeline = (GameObject)Instantiate(prefab_pl_moving2, new Vector3(0, 5.5f, 0), Quaternion.identity); distanceToNextPipe = 2.55f; break; case PipeLine.PipeLineType.stair2: newPipeline = (GameObject)Instantiate(prefab_pl_stair2, new Vector3(0, 5.5f, 0), Quaternion.identity); distanceToNextPipe = 2.55f; break; case PipeLine.PipeLineType.stair3: newPipeline = (GameObject)Instantiate(prefab_pl_stair3, new Vector3(0, 5.5f, 0), Quaternion.identity); distanceToNextPipe = 3.1f; break; case PipeLine.PipeLineType.stair4: newPipeline = (GameObject)Instantiate(prefab_pl_stair4, new Vector3(0, 5.5f, 0), Quaternion.identity); distanceToNextPipe = 3.65f; break; default: newPipeline = (GameObject)Instantiate(prefab_pl_simple, new Vector3(0, 5.5f, 0), Quaternion.identity); distanceToNextPipe = 2; break; } if (lastPipeLine) { lastPipeLine.GetComponent <PipeLine>().setNextPipeLine(newPipeline); } lastPipeLine = newPipeline; PipeLine npl = newPipeline.GetComponent <PipeLine>(); npl.speed = currentSpeed; npl.type = nextPLtypename; npl.holeWidth = minHoleWidth + (maxHoleWidth - minHoleWidth) * (timeToMaxSpeedLeft / timeToMaxSpeedFull); npl.enabled = true; if (pipeCounter == 0) { ArenaController arena = this.GetComponent <ArenaController>(); arena.arenaPipeLine = npl; arena.enabled = true; arena.isFighting = false; this.enabled = false; } }
public ArenaController() { Instance = this; }