Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 protected override void Start()
 {
     trigger = triggerObj.GetComponent <AreaTrigger>();
     trigger.playerEntered += Trigger_playerEntered;
     agro = false;
     base.Start();
 }
Ejemplo n.º 2
0
        public static void RegisterEvents()
        {
            var standEntry = GOMgr.GetEntry(SilverwingFlagStandId) as GOFlagStandEntry;

            standEntry.Side = BattlegroundSide.Alliance;
            var droppedEntry = GOMgr.GetEntry(SilverwingFlagId) as GOFlagDropEntry;

            droppedEntry.Side = BattlegroundSide.Alliance;

            standEntry        = GOMgr.GetEntry(WarsongClanFlagStandId) as GOFlagStandEntry;
            standEntry.Side   = BattlegroundSide.Horde;
            droppedEntry      = GOMgr.GetEntry(WarsongFlagId) as GOFlagDropEntry;
            droppedEntry.Side = BattlegroundSide.Horde;

            // register AreaTrigger capture events
            AreaTrigger hordeFlagAT    = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchHordeFlagSpawn);
            AreaTrigger allianceFlagAT = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchAllianceFlagSpawn);

            hordeFlagAT.Triggered    += HordeCaptureTriggered;
            allianceFlagAT.Triggered += AllianceCaptureTriggered;

            GOMgr.GetEntry(WarsongClanFlagStandId).Used += HandleFlagStandUsed;
            GOMgr.GetEntry(SilverwingFlagStandId).Used  += HandleFlagStandUsed;

            GOMgr.GetEntry(WarsongFlagId).Used    += HandleDroppedFlagUsed;
            GOMgr.GetEntry(SilverwingFlagId).Used += HandleDroppedFlagUsed;
        }
Ejemplo n.º 3
0
    public void ExitAreaTrigger(AreaTrigger trigger)
    {
        if (!areaTriggers.Contains(trigger))
        {
            return;
        }

        if (areaTriggers.Count > 1)
        {
            if (trigger.alwaysExitActions)
            {
                trigger.OnAreaExit(this);
            }
            areaTriggers.Remove(trigger);

            if (trigger != areaTriggers[areaTriggers.Count - 1])
            {
                areaTriggers[areaTriggers.Count - 1].OnAreaEnter(this);
            }
        }
        else
        {
            trigger.OnAreaExit(this);
            areaTriggers.Remove(trigger);
        }
    }
Ejemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     i += Time.deltaTime;
     if ((int)i == 5)
     {
         timer++;
         foodEated--;
         i        = 0;
         txt.text = timer.ToString();
     }
     if (foodEated == 0)
     {
         Destroy(gameObject);
     }
     if (timer % 5 == 0 && temp == 0 && timer != 0 && timer != 1)
     {
         GameObject  thePlayer    = gameObject;
         AreaTrigger playerScript = thePlayer.GetComponent <AreaTrigger>();
         playerScript.GeneraCibo();
         temp = 1;
     }
     if (timer % 5 != 0)
     {
         temp = 0;
     }
 }
Ejemplo n.º 5
0
 // Start is called before the first frame update
 void Start()
 {
     trigger                = triggerObj.GetComponent <AreaTrigger>();
     trigger.areaClear     += Trigger_areaClear;
     trigger.playerEntered += Trigger_playerEntered;
     transform.localScale   = Vector3.zero;
 }
Ejemplo n.º 6
0
 private void RegisterEvents()
 {
     AreaTrigger blacksmithAT = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinBlackSmith);
     AreaTrigger stablesAT    = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinStables);
     AreaTrigger farmAT       = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinFarm);
     AreaTrigger lumberMillAT = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinLumberMill);
     AreaTrigger goldMineAT   = AreaTriggerMgr.GetTrigger(AreaTriggerId.ArathiBasinGoldMine);
 }
Ejemplo n.º 7
0
        static void OnObservanceHallTriggered(AreaTrigger at, Character chr)
        {
            var instance = chr.Map as UtgardePinnacle;

            if (instance != null && !instance.m_EncounterStarted)
            {
                instance.StartEncounter();
            }
        }
Ejemplo n.º 8
0
        void HandleEffectPeriodic(AuraEffect aurEff)
        {
            AreaTrigger at = GetTarget().GetAreaTrigger(SpellIds.Consecration);

            if (at != null)
            {
                GetTarget().CastSpell(at.GetPosition(), SpellIds.ConsecrationDamage, new CastSpellExtraArgs());
            }
        }
Ejemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     //Assigning in AreaTriggers
     for (int k = 0; k < numOfBricks; k++)
     {
         bricksTrigger[k] = BricksParent[k].GetComponent<AreaTrigger>();
     }
     tableBrickTrigger = TableBrickParent.GetComponent<AreaTrigger>();
 }
Ejemplo n.º 10
0
        public static void HandleAreaTriggerOpcode(ref PacketReader packet, ref WorldManager manager)
        {
            uint triggerID = packet.ReadUInt32();

            if (Database.AreaTriggers.ContainsKey(triggerID))
            {
                AreaTrigger a = Database.AreaTriggers.TryGet(triggerID);
                manager.Character.Teleport(a.Map, a.GetQuaternion());
            }
        }
Ejemplo n.º 11
0
    public void EnterAreaTrigger(AreaTrigger trigger)
    {
        if (areaTriggers.Contains(trigger))
        {
            areaTriggers.Add(trigger); return;
        }
        areaTriggers.Add(trigger);

        trigger.OnAreaEnter(this);
    }
Ejemplo n.º 12
0
        public void NotifyCollisionEnter(AreaTrigger trigger)
        {
            ++CollisionsThisFrame;
            if (TimeBetweenCollisions > 0f)
            {
                CollisionTimer = TimeBetweenCollisions;
            }

            OnHitboxEnter(trigger);
        }
Ejemplo n.º 13
0
        public AreaTrigger BuildAreaTrigger(DataRow row)
        {
            var areaTrigger = new AreaTrigger();

            areaTrigger.id     = row["m_id"] != DBNull.Value ? CustomConverter.ToInt32(row["m_id"]) : -1;
            areaTrigger.map_id = row["m_mapId"] != DBNull.Value ? CustomConverter.ToInt32(row["m_mapId"]) : 0;
            areaTrigger.posX   = row["m_posX"] != DBNull.Value ? (double)row["m_posX"] : 0;
            areaTrigger.posY   = row["m_posY"] != DBNull.Value ? (double)row["m_posY"] : 0;
            areaTrigger.posZ   = row["m_posZ"] != DBNull.Value ? (double)row["m_posZ"] : 0;
            return(areaTrigger);
        }
Ejemplo n.º 14
0
 public override AreaTriggerAI GetAI(AreaTrigger me)
 {
     if (me.GetInstanceScript() != null)
     {
         return(GetInstanceAI <AI>(me));
     }
     else
     {
         return((AI)Activator.CreateInstance(typeof(AI), new object[] { me }.Combine(_args)));
     }
 }
Ejemplo n.º 15
0
 private void AddActionsFromAreaTrigger(DictionaryView <string, AGE.Action> actions)
 {
     AreaTrigger[] triggerArray = UnityEngine.Object.FindObjectsOfType <AreaTrigger>();
     if ((triggerArray != null) && (triggerArray.Length != 0))
     {
         for (int i = 0; i < triggerArray.Length; i++)
         {
             AreaTrigger trigger = triggerArray[i];
             this.AddActionsFromSkillCombine(actions, trigger.BuffID);
             this.AddActionsFromSkillCombine(actions, trigger.UpdateBuffID);
         }
     }
 }
Ejemplo n.º 16
0
 public void BuildAreaTrigger(ref ActorPreloadTab loadInfo)
 {
     AreaTrigger[] triggerArray = UnityEngine.Object.FindObjectsOfType <AreaTrigger>();
     if ((triggerArray != null) && (triggerArray.Length != 0))
     {
         for (int i = 0; i < triggerArray.Length; i++)
         {
             AreaTrigger trigger = triggerArray[i];
             this.AnalyseSkillCombine(ref loadInfo, trigger.BuffID);
             this.AnalyseSkillCombine(ref loadInfo, trigger.UpdateBuffID);
             this.AnalyseSkillCombine(ref loadInfo, trigger.LeaveBuffID);
         }
     }
 }
Ejemplo n.º 17
0
 private void AddActionsFromAreaTrigger(DictionaryView <string, Action> actions)
 {
     AreaTrigger[] array = Object.FindObjectsOfType <AreaTrigger>();
     if (array == null || array.Length == 0)
     {
         return;
     }
     for (int i = 0; i < array.Length; i++)
     {
         AreaTrigger areaTrigger = array[i];
         this.AddActionsFromSkillCombine(actions, areaTrigger.BuffID);
         this.AddActionsFromSkillCombine(actions, areaTrigger.UpdateBuffID);
     }
 }
Ejemplo n.º 18
0
 public void BuildAreaTrigger(ref ActorPreloadTab loadInfo)
 {
     AreaTrigger[] array = Object.FindObjectsOfType <AreaTrigger>();
     if (array == null || array.Length == 0)
     {
         return;
     }
     for (int i = 0; i < array.Length; i++)
     {
         AreaTrigger areaTrigger = array[i];
         this.AnalyseSkillCombine(ref loadInfo, areaTrigger.BuffID);
         this.AnalyseSkillCombine(ref loadInfo, areaTrigger.UpdateBuffID);
         this.AnalyseSkillCombine(ref loadInfo, areaTrigger.LeaveBuffID);
     }
 }
Ejemplo n.º 19
0
        public AreaTrigger BuildAreaTrigger(DataRow row)
        {
            var areaTrigger = new AreaTrigger();

            areaTrigger.id     = row["m_id"] != DBNull.Value ? XConverter.ToInt32(row["m_id"]) : -1;
            areaTrigger.map_id = row["m_mapId"] != DBNull.Value ? XConverter.ToInt32(row["m_mapId"]) : 0;
            areaTrigger.posX   = row["m_posX"] != DBNull.Value ? (double)row["m_posX"] : 0;
            areaTrigger.posY   = row["m_posY"] != DBNull.Value ? (double)row["m_posY"] : 0;
            areaTrigger.posZ   = row["m_posZ"] != DBNull.Value ? (double)row["m_posZ"] : 0;
            areaTrigger.field5 = row["field5"] != DBNull.Value ? (int)row["field5"] : 0;
            areaTrigger.field6 = row["field6"] != DBNull.Value ? (int)row["field6"] : 0;
            areaTrigger.field7 = row["field7"] != DBNull.Value ? (int)row["field7"] : 0;
            areaTrigger.field8 = row["field8"] != DBNull.Value ? (double)row["field8"] : 0;
            areaTrigger.field9 = row["field9"] != DBNull.Value ? (double)row["field9"] : 0;
            return(areaTrigger);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Somebody stepped on the Alliance capture areatrigger
        /// </summary>
        /// <param name="at"></param>
        /// <param name="chr"></param>
        private static void AllianceCaptureTriggered(AreaTrigger at, Character chr)
        {
            // Check whether the battle has started and the Character is actively participating
            BattlegroundTeam team = chr.Battlegrounds.Team;
            var wsg = chr.Map as WarsongGulch;

            if (team != null && wsg != null && wsg.IsActive)
            {
                if (team.Side == BattlegroundSide.Alliance)
                {
                    if (wsg.WarsongClan.FlagCarrier == chr && wsg.Silverwing.IsFlagHome)
                    {
                        wsg.WarsongClan.CaptureFlag(chr);
                    }
                }
            }
        }
Ejemplo n.º 21
0
        public static void HandleAreaTrigger(IRealmClient client, RealmPacketIn packet)
        {
            uint      id = packet.ReadUInt32();
            Character activeCharacter = client.ActiveCharacter;

            if (!activeCharacter.IsAlive)
            {
                return;
            }
            AreaTrigger trigger = AreaTriggerMgr.GetTrigger(id);

            if (trigger == null)
            {
                return;
            }
            trigger.Trigger(activeCharacter);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Register's the powerup AT triggers to cast the spell and remove the GO.
        /// </summary>
        private void RegisterPowerupEvents()
        {
            AreaTrigger allianceBerserker =
                AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchAllianceElexirOfBerserkSpawn);
            AreaTrigger allianceFood =
                AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchAllianceElexirOfRegenerationSpawn);
            AreaTrigger allianceSpeed = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchAllianceElexirOfSpeedSpawn);

            AreaTrigger hordeBerserker = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchHordeElexirOfBerserkSpawn);
            AreaTrigger hordeFood      = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchHordeElexirOfRegenerationSpawn);
            AreaTrigger hordeSpeed     = AreaTriggerMgr.GetTrigger(AreaTriggerId.WarsongGulchHordeElexirOfSpeedSpawn);

            allianceBerserker.Triggered += (at, unit) => HandlePowerUp(unit, SpellId.None, _allianceBerserkerBuff, SpawnAllianceBerserkerBuff);
            allianceFood.Triggered      += (at, unit) => HandlePowerUp(unit, SpellId.None, _allianceFoodBuff, SpawnAllianceFoodBuff);
            allianceSpeed.Triggered     += (at, unit) => HandlePowerUp(unit, SpellId.Speed_5, _allianceSpeedBuff, SpawnAllianceSpeedBuff);

            hordeBerserker.Triggered += (at, unit) => HandlePowerUp(unit, SpellId.None, _hordeBerserkerBuff, SpawnHordeBerserkerBuff);
            hordeFood.Triggered      += (at, unit) => HandlePowerUp(unit, SpellId.None, _hordeFoodBuff, SpawnHordeFoodBuff);
            hordeSpeed.Triggered     += (at, unit) => HandlePowerUp(unit, SpellId.Speed_5, _hordeSpeedBuff, SpawnHordeSpeedBuff);
        }
Ejemplo n.º 23
0
        public static int loadAreaTriggers(string mapIdentifier)
        {
            if (!Constants.VFSSkip)
            {
                vfsDataProvider.Instance.unpackFromVFS("data\\map" + mapIdentifier + "\\map" + mapIdentifier + ".bin", "data\\maps\\map" + mapIdentifier + ".bin");
            }

            if (!File.Exists(AppDomain.CurrentDomain.BaseDirectory + "data/maps/map" + mapIdentifier + ".bin"))
            {
                return(0);
            }

            int areaTrigger_counts = 0;

            int mapID = Convert.ToInt32(mapIdentifier);

            byte[] data = File.ReadAllBytes(AppDomain.CurrentDomain.BaseDirectory + "data/maps/map" + mapIdentifier + ".bin");

            for (int i = 0; i < 12; i++)
            {
                if (BitConverter.ToSingle(data, 8 + (i * 8)) == 0 && 0 == BitConverter.ToSingle(data, 12 + (i * 8)))
                {
                    continue;
                }
                AreaTrigger areaTrigger = new AreaTrigger();
                areaTrigger.setFromPosition(new float[] { BitConverter.ToSingle(data, 8 + (i * 8)), BitConverter.ToSingle(data, 12 + (i * 8)) });
                areaTrigger.setfMap((short)mapID);
                areaTrigger.setToPosition(new float[] { BitConverter.ToSingle(data, 200 + (i * 8)), BitConverter.ToSingle(data, 204 + (i * 8)) });
                areaTrigger.settMap(BitConverter.ToInt16(data, 136 + (i * 4)));
                areaTrigger.setRequiredItem(
                    (areaTrigger.getFromPosition()[0] == -1567 && areaTrigger.getFromPosition()[1] == 1991 && areaTrigger.gettMap() == 3) ? (213062201) :
                    (areaTrigger.getFromPosition()[0] == -1634 && areaTrigger.getFromPosition()[1] == 3050 && areaTrigger.gettMap() == 3) ? (213062200) :
                    (0));                     // damn koreanz
                WMap.Instance.getGrid(mapID).getAreaByRound(areaTrigger.getFromPosition()[0], areaTrigger.getFromPosition()[1]).addAreaTrigger(areaTrigger);
                areaTrigger_counts++;
            }

            return(areaTrigger_counts);
        }
Ejemplo n.º 24
0
    // Update is called once per frame
    void Update()
    {
        GameObject  thePlayer    = gameObject;
        AreaTrigger playerScript = thePlayer.GetComponent <AreaTrigger>();

        obj = playerScript.ParameterPass;

        try
        {
            if (Vector3.Distance(transform.position, obj.transform.position) < 5f)
            {
                target = obj.transform;
                float step = speed * Time.deltaTime;
                transform.position = Vector3.MoveTowards(transform.position, target.position, step);
            }
            else
            {
                float step = speedWalk * Time.deltaTime;
                transform.position = Vector3.MoveTowards(transform.position, posizione, step);
                if ((int)transform.position.x == (int)posizione.x && (int)transform.position.z == (int)posizione.z)
                {
                    posizione = new Vector3(Random.Range(-24.0f, 24.0f), 0.5f, Random.Range(-24.0f, 24.0f));
                }
            }
        }
        catch (System.Exception)
        {
            float step = speedWalk * Time.deltaTime;
            transform.position = Vector3.MoveTowards(transform.position, posizione, step);
            if ((int)transform.position.x == (int)posizione.x && (int)transform.position.z == (int)posizione.z)
            {
                posizione = new Vector3(Random.Range(-24.0f, 24.0f), 0.5f, Random.Range(-24.0f, 24.0f));
            }
            return;
        }
    }
Ejemplo n.º 25
0
 public areatrigger_stormwind_teleport_unit(AreaTrigger areatrigger) : base(areatrigger)
 {
 }
Ejemplo n.º 26
0
 public override AreaTriggerAI GetAI(AreaTrigger areaTrigger)
 {
     return(new SmartAreaTriggerAI(areaTrigger));
 }
Ejemplo n.º 27
0
 public virtual void JustUnregisteredAreaTrigger(AreaTrigger areaTrigger)
 {
 }
Ejemplo n.º 28
0
 // Called when a AreaTriggerAI object is needed for the areatrigger.
 public virtual AreaTriggerAI GetAI(AreaTrigger at)
 {
     return(null);
 }
Ejemplo n.º 29
0
 public override AreaTriggerAI GetAI(AreaTrigger areatrigger)
 {
     return(new areatrigger_pri_angelic_featherAI(areatrigger));
 }
Ejemplo n.º 30
0
 public areatrigger_pri_angelic_featherAI(AreaTrigger areatrigger) : base(areatrigger)
 {
 }
Ejemplo n.º 31
0
 public NullAreaTriggerAI(AreaTrigger areaTrigger) : base(areaTrigger)
 {
 }
Ejemplo n.º 32
0
 void Start()
 {
     //heldHammer.SetActive(false);
     hammerAreaTrig = HammerRegion.GetComponent<AreaTrigger>();
 }