Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     vzriv     = GameObject.Find("Vzrivplay").GetComponent <AudioSource>();
     dopDamage = 1;
     speed     = Random.Range(-3f, 3f);
     dam       = 1;
     fireRate  = 0.5f;
     ed        = gameObject.GetComponent <EnemyDeath>();
     InvokeRepeating("CheckRotate", 8f, 3f);
     gs = GameObject.Find("GameManager").GetComponent <GameStats>();
     sr = gameObject.GetComponent <SpriteRenderer>();
     NextPos();
     rotatingSpeed = Random.Range(-3f, 3f);
     player1       = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>();
     gamemanager   = GameObject.Find("GameManager");
     menu          = gamemanager.GetComponent <Menu>();
     spawnmob      = gamemanager.GetComponent <SpawnMobs>();
 }
Ejemplo n.º 2
0
    public void ShowHighScore(float exp)
    {
        SpawnMobs sm = GameObject.Find("GameManager").GetComponent <SpawnMobs>();

        for (int i = 0; i < sm.mobs.Count; i++)
        {
            sm.mobs[i].SetActive(false);
        }
        mobile.SetActive(false);
        slider1.SetActive(false);
        slider2.SetActive(false);
        butTal.SetActive(false);
        gameObject.GetComponent <SpawnCrystal>().enabled = false;
        gameObject.GetComponent <PlayerSpawn>().enabled  = false;
        gameObject.GetComponent <SpawnMobs>().enabled    = false;
        gameObject.GetComponent <Ultimates>().nothing.SetActive(false);
        scoreEnd.SetActive(true);
        ScoreEnd.text = Mathf.RoundToInt(exp).ToString();
        isNextPos     = true;
        isDeadPlay    = true;
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     CreateHero(Ship, Vector2.zero, new Quaternion(0, 0, 0, 0), 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0);
     spawnmobs = gameObject.GetComponent <SpawnMobs>();
 }
Ejemplo n.º 4
0
        public ScriptManager()
        {
            Logger.ShowInfo("Loading spawn templates", null);
            LoadSpawnTemplates("DB/spawntemplates.xml");
            Logger.ShowInfo("Loading mob spawns", null);
            LoadSpawnFile("DB/Spawns");

            Logger.ShowInfo("Loading uncompiled scripts", null);
            CSharpCodeProvider provider = new CSharpCodeProvider();
            int npccount     = 0;
            int mapitemcount = 0;

            try
            {
                try
                {
                    Assembly newAssembly = CompileScript(Directory.GetFiles("scripts/npcs", "*.cs", SearchOption.AllDirectories), provider);
                    int[]    tmp;
                    if (newAssembly != null)
                    {
                        tmp           = LoadAssembly(newAssembly);
                        mapitemcount += tmp[0];
                        npccount     += tmp[1];
                    }
                    newAssembly = CompileScript(Directory.GetFiles("scripts/Scenario", "*.cs", SearchOption.AllDirectories), provider);
                    Module[] newScripts = newAssembly.GetModules();
                    foreach (Module newScript in newScripts)
                    {
                        Type[] types = newScript.GetTypes();
                        foreach (Type npcType in types)
                        {
                            try
                            {
                                this.Scenario = (SagaMap.Scenario)newAssembly.CreateInstance(npcType.Name);
                            }
                            catch (Exception ex)
                            {
                                Logger.ShowError(ex, null);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logger.ShowError(ex, null);
                }
            }
            catch (Exception) { }
            Logger.ShowInfo("Loading compiled scripts", null);
            try
            {
                foreach (string s in Directory.GetFiles("cscripts"))
                {
                    try
                    {
                        int[]    tmp;
                        Assembly newAssembly = Assembly.LoadFrom(s);
                        tmp           = LoadAssembly(newAssembly);
                        mapitemcount += tmp[0];
                        npccount     += tmp[1];
                    }
                    catch (Exception) { }
                }
            }
            catch (Exception) { }
            Logger.ShowInfo(string.Format("{0} NPCs and {1} MapItems Added", npccount, mapitemcount), null);
            this.spawnTask = new SpawnMobs(this);
            this.spawnTask.Activate();
        }