Exemplo n.º 1
0
    public void spawnGuard()
    {
        GameObject NewSpawn;
        Person     NewSpawnPerson;
        //GameObject CarGSpawn;
        AIGuard aiguard;

        Vector3        spawn;
        SteerForTarget steerfortarget;

        bool spawnedGuard = false;


        while (spawnedGuard == false)
        {
            for (int i = 0; i < Guard_db.Count; i++)
            {
                if (Guard_db[i].tech.Spawned == false && Guard_db[i].tech.IsDead == false)
                {
                    //CarGSpawn = GameObject.Find("CarG1");


                    spawn    = new Vector3(25f, 0f, 31f);//CarGSpawn.transform.position;
                    NewSpawn = (GameObject)Instantiate(pf_Guard, spawn, Quaternion.identity);

                    Guard_db[Guard_db.Count - 1].tech.TimesSpawned++;
                    Guard_db[Guard_db.Count - 1].tech.Spawned = true;

                    NewSpawnPerson       = NewSpawn.GetComponent <Person>();
                    NewSpawnPerson.stats = Guard_db[Guard_db.Count - 1].stats;
                    NewSpawnPerson.tech  = Guard_db[Guard_db.Count - 1].tech;

                    steerfortarget        = NewSpawn.GetComponent <SteerForTarget>();
                    steerfortarget.Target = new Vector3(21, 0, 25);

                    NewSpawn.name = NewSpawnPerson.stats.Name;
                    NewSpawn.tag  = "Guard";

                    Guards_InPlay.Add(Guard_db[i]);

                    aiguard        = NewSpawn.GetComponent <AIGuard>();
                    aiguard.mode   = AIGuard.Mode.user;
                    aiguard.MoveTo = new Vector3(21, 0, 25);
                    spawnedGuard   = true;
                }
            }

            if (spawnedGuard == false)
            {
                createNewChar("GUARD", 1);
            }
        }
    }
Exemplo n.º 2
0
    public void spawnSkabenga(int level)
    {
        GameObject NewSpawn;
        GameObject SkaSpawn;

        int SkaPoint;

        Person NewSpawnPerson;

        Vector3        spawn;
        SteerForTarget steerfortarget;

        bool spawnedSkabenga = false;


        while (spawnedSkabenga == false)
        {
            for (int i = 0; i < Skabenga_db.Count; i++)
            {
                if (Skabenga_db[i].tech.Spawned == false && Skabenga_db[i].tech.IsDead == false)
                {
                    SkaPoint = Random.Range(1, 4);
                    switch (SkaPoint)
                    {
                    case 1:
                        SkaSpawn = GameObject.Find("Ska1");
                        break;

                    case 2:
                        SkaSpawn = GameObject.Find("Ska2");
                        break;

                    case 3:
                        SkaSpawn = GameObject.Find("Ska3");
                        break;

                    default:
                        SkaSpawn = GameObject.Find("Ska1");
                        break;
                    }


                    //spawn
                    spawn    = SkaSpawn.transform.position;
                    NewSpawn = (GameObject)Instantiate(pf_Skabenga, spawn, Quaternion.identity);

                    Skabenga_db[Skabenga_db.Count - 1].tech.TimesSpawned++;
                    Skabenga_db[Skabenga_db.Count - 1].tech.Spawned   = true;
                    Skabenga_db[Skabenga_db.Count - 1].tech.IsVisible = false;
                    Skabenga_db[Skabenga_db.Count - 1].tech.stance    = Tech.Stance.hide;
                    Skabenga_db[Skabenga_db.Count - 1].tech.IsinDark  = false;

                    NewSpawnPerson       = NewSpawn.GetComponent <Person>();
                    NewSpawnPerson.stats = Skabenga_db[Skabenga_db.Count - 1].stats;
                    NewSpawnPerson.tech  = Skabenga_db[Skabenga_db.Count - 1].tech;

                    steerfortarget        = NewSpawn.GetComponent <SteerForTarget>();
                    steerfortarget.Target = spawn;

                    NewSpawn.name = NewSpawnPerson.stats.Name;
                    NewSpawn.tag  = "Skabenga";

                    Skabengas_InPlay.Add(Skabenga_db[i]);

                    spawnedSkabenga = true;
                }
            }

            if (spawnedSkabenga == false)
            {
                createNewChar("SKABENGA", level);
            }
        }
    }