Ejemplo n.º 1
0
    public override void DrawTask(Scene scene)
    {
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Target");
        Target = (Transform)EditorGUILayout.ObjectField(Target, typeof(Transform), true);
        EditorGUILayout.EndHorizontal();

        if (Target == null)
        {
            EditorGUILayout.HelpBox($"Target Cannot be empty", MessageType.Error);
        }

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Actor");
        Actor = (ActorAgent)EditorGUILayout.ObjectField(Actor, typeof(ActorAgent), true);
        EditorGUILayout.EndHorizontal();

        if (Actor == null)
        {
            EditorGUILayout.HelpBox($"Actor Cannot be empty", MessageType.Error);
        }

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("ActorSpeed");
        ActorSpeed = EditorGUILayout.FloatField(ActorSpeed);
        EditorGUILayout.EndHorizontal();

        base.DrawTask(scene);
    }
Ejemplo n.º 2
0
        private static void SpawnGangMonsters()
        {
            if (gangSpawned)
            {
                Dbgl("spawning gang members");
                int gangNo = new IntR(settings.MinGang, settings.MaxGang).GetValue(rand);
                for (int i = 0; i < gangNo; i++)
                {
                    int     l337 = new IntR(1, Get1337Level() - 1).GetValue(rand);
                    Monster mLow = GetRandomMonster(rand, l337);

                    Vector3 pos = GetValidPos(GetGroupPos(bossMonster.pos.Value, i, 8f, 4f));
                    if (pos == Vector3.zero)
                    {
                        Dbgl("gang member invalid position");
                        if (gangNo < settings.MaxGang * 2)
                        {
                            gangNo++;
                        }
                        continue;
                    }
                    Dbgl("gang member valid position");
                    ActorAgent agentLow = new ActorAgent(pos, bossMonster.rot, mLow.id, new Action <ActorAgent>(MonsterGangDeath));
                    Module <SpawnMgr> .Self.AddActorAgent(agentLow);

                    agentLow.Spawn();
                }
            }
        }
Ejemplo n.º 3
0
 public virtual void AddNeighbour(ActorAgent neighbour)
 {
     if (neighbours == null)
         neighbours = new List<ActorAgent>();
     if (!neighbours.Contains(neighbour))
         neighbours.Add(neighbour);
 }
Ejemplo n.º 4
0
 public virtual void RemoveNeighbour(ActorAgent neighbour)
 {
     if (neighbours == null)
     {
         neighbours = new List <ActorAgent>();
     }
     neighbours.Remove(neighbour);
 }
Ejemplo n.º 5
0
 public virtual void AddNeighbour(ActorAgent neighbour)
 {
     if (neighbours == null)
     {
         neighbours = new List <ActorAgent>();
     }
     if (!neighbours.Contains(neighbour))
     {
         neighbours.Add(neighbour);
     }
 }
Ejemplo n.º 6
0
        public static void MonsterDeath(ActorAgent agent)
        {
            monsterAlive = false;
            Module <SpawnMgr> .Self.RemoveActorAgent(agent);

            Module <AreaTriggerManager> .Self.DestroyTrigger(triggerID);

            if (settings.RelationChange)
            {
                Module <FavorManager> .Self.GiveGiftToAllFavorObject(Get1337Level() * 5);

                Singleton <TipsMgr> .Instance.SendSimpleTip("You defeated the " + monsterName + "! There is much rejoicing!");
            }
        }
Ejemplo n.º 7
0
        private static void TestSpawnAllMonsters()
        {
            var allMonsters = new Monster[MonstersLow.Length + MonstersMid.Length + MonstersHigh.Length + MonstersElite.Length];

            MonstersLow.CopyTo(allMonsters, 0);
            MonstersMid.CopyTo(allMonsters, MonstersLow.Length);
            MonstersHigh.CopyTo(allMonsters, MonstersLow.Length + MonstersMid.Length);
            MonstersElite.CopyTo(allMonsters, MonstersLow.Length + MonstersMid.Length + MonstersHigh.Length);

            foreach (Monster mm in allMonsters)
            {
                ActorAgent aa = new ActorAgent(mm.pos.Value, mm.rot, mm.id, new Action <ActorAgent>(MonsterDeath));
                Dbgl("monster: " + mm.id);
                Module <SpawnMgr> .Self.AddActorAgent(aa);

                aa.Spawn();
            }
        }
Ejemplo n.º 8
0
        private static void OnWakeUp(object[] obj)
        {
            if (agent != null)
            {
                Module <SpawnMgr> .Self.RemoveActorAgent(agent);

                agent.Destroy();
            }
            Module <AreaTriggerManager> .Self.DestroyTrigger(triggerID);

            monsterAlive = false;

            //TestSpawnAllMonsters();
            //SpawnAllPoints();
            //return;

            int randSeed = (int)DateTime.UtcNow.Ticks + UnityEngine.Random.Range(0, 9999);

            System.Random rand = new System.Random(randSeed);

            int chance = new IntR(1, 100).GetValue(rand);

            Dbgl("Chance: " + chance);

            if (chance > settings.ChanceInvade)
            {
                return;
            }

            Monster m = GetRandomMonster(rand);

            agent = new ActorAgent(m.pos.Value, m.rot, m.id, new Action <ActorAgent>(MonsterDeath));
            Module <SpawnMgr> .Self.AddActorAgent(agent);

            agent.Spawn();
            areaTrigger = Module <AreaTriggerManager> .Self.CreateAreaTrigger(triggerID, m.pos.Value, "Main", 40, true);

            monsterAlive = true;
            monsterName  = m.name;
            char[] vowels = { 'A', 'E', 'I', 'O', 'U' };
            Singleton <TipsMgr> .Instance.SendSystemTip((vowels.Contains(monsterName[0]) ? "An " : "A ") + monsterName + " is attacking " + m.pos.Key + "!", SystemTipType.danger);
        }
Ejemplo n.º 9
0
 private void Start()
 {
     owner = GetComponentInParent<ActorAgent>();
     cover = GetComponentInParent<Cover>();
 }
Ejemplo n.º 10
0
 public static void MonsterGangDeath(ActorAgent agent)
 {
     agent.Destroy();
     Module <SpawnMgr> .Self.RemoveActorAgent(agent);
 }
Ejemplo n.º 11
0
 private void Start()
 {
     owner = GetComponentInParent <ActorAgent>();
     cover = GetComponentInParent <Cover>();
 }
Ejemplo n.º 12
0
 public virtual void RemoveNeighbour(ActorAgent neighbour)
 {
     if (neighbours == null)
         neighbours = new List<ActorAgent>();
     neighbours.Remove(neighbour);
 }