Exemple #1
0
    void Start()
    {
        wb          = FindObjectOfType <WeaponBench>();
        pab         = FindObjectOfType <PassiveBench>();
        pob         = FindObjectOfType <PowerupBench>();
        mp          = FindObjectOfType <MusicPlayer>();
        ic          = FindObjectOfType <InputController>();
        gops        = FindObjectOfType <GameOptions>();
        TMPBUI      = GameObject.Find("TMPBUI").GetComponent <TextMeshProUGUI>();
        TMPTUT      = GameObject.Find("TMPTUT").GetComponent <TextMeshProUGUI>();
        TMPTUI      = GameObject.Find("TMPTUI").GetComponent <TextMeshProUGUI>();
        TMPHS       = GameObject.Find("TMPHS").GetComponent <TextMeshProUGUI>();
        TMPBank     = GameObject.Find("TMPBank").GetComponent <TextMeshPro>();
        TMPTime     = GameObject.Find("TMPTime").GetComponent <TextMeshPro>();
        tutanim     = TMPTUT.GetComponent <Animator>();
        altar       = FindObjectOfType <Altar>();
        player      = FindObjectOfType <Player>();
        statl       = FindObjectOfType <StatLibrary>();
        sc          = FindObjectOfType <SpawnController>();
        TMPHS.text  = "";
        TMPTUT.text = "";
        ClearStats();

        killtext    = "Kill enemies to get necromantic energy (Detrizide).";
        dttext      = "Press or hold the " + ic.Detrizide + " key when weapon is flashing to spend energy and cast spells. Do this constantly.";
        weapontext  = "Collect weapons from the gold flashing altar in the middle once their cost has been paid.";
        passivetext = "Collect passive upgrades from the blue flashing altar to the west once their cost has been paid. ";
        poweruptext = "Powerups will periodically become available. Acquire them from the red flashing altar in the east to temporarily gain a bonus.";
        ammotext    = "Some weapons run out of ammo. Switch weapons using " + ic.CycleWeapons + " or " + ic.NextWeapon + " to refill ammo.";
        swtext      = "The Void Cannon and Devourer weapons are superweapons. These do immense damage, but cost banked Detrizide to use. Cost increases each use. ";
    }
Exemple #2
0
 private void Start()
 {
     statl  = FindObjectOfType <StatLibrary>();
     altar  = FindObjectOfType <Altar>();
     player = FindObjectOfType <Player>();
     sc     = FindObjectOfType <SpawnController>();
     sl     = FindObjectOfType <SoundLibrary>();
 }
Exemple #3
0
    // Return a new student with random stats in an appropriate range
    public static Student GenerateStudent()
    {
        double grade     = StatLibrary.NextGaussianDoubleWithAvgStd(GRADE_STD, AVERAGE_GRADE);
        double happiness = StatLibrary.NextGaussianDoubleWithAvgStd(HAPPINESS_STD, AVERAGE_HAPPINESS);
        double stress    = StatLibrary.NextGaussianDoubleWithAvgStd(STRESS_STD, AVERAGE_STRESS);

        //Debug.Log("Making a student with grade " + grade + " and happiness " + happiness + " and stress " + stress);
        return(new Student(grade, happiness, stress));
    }
Exemple #4
0
 public virtual void Start()
 {
     camera = FindObjectOfType <Camera>();
     uic    = FindObjectOfType <UIController>();
     pjtsf  = GameObject.Find("Projectiles").transform;
     unit   = FindObjectOfType <Player>().GetComponent <Unit>();
     sl     = FindObjectOfType <StatLibrary>();
     aso    = FindObjectOfType <Player>().GetComponent <AudioSource>();
 }
Exemple #5
0
 void Start()
 {
     altar      = FindObjectOfType <Altar>();
     wb         = FindObjectOfType <WeaponBench>();
     sl         = FindObjectOfType <StatLibrary>();
     detrianim  = GetComponent <Animator>();
     detriLight = gameObject;
     SetDTColours();
     saveOriginalMaterials();
 }
Exemple #6
0
 void Start()
 {
     aso               = GetComponent <AudioSource>();
     TMPWN             = GameObject.Find("TMPWeaponNum").GetComponent <TextMeshPro>();
     player            = FindObjectOfType <Player>();
     sl                = FindObjectOfType <SoundLibrary>();
     statl             = FindObjectOfType <StatLibrary>();
     sc                = FindObjectOfType <SpawnController>();
     originalMaterials = new List <Material>();
     renderers         = new List <MeshRenderer>(GetComponentsInChildren <MeshRenderer>());
     FindObjectOfType <Detrilight>().saveOriginalMaterials(originalMaterials, gameObject);
 }
Exemple #7
0
 void Start()
 {
     wb         = FindObjectOfType <WeaponBench>();
     fwanimator = GameObject.FindGameObjectWithTag("FadeWall").GetComponent <Animator>();
     altar      = FindObjectOfType <Altar>();
     //resUnit = altar.GetResUnit();
     ic            = FindObjectOfType <InputController>();
     weaponmanager = FindObjectOfType <WeaponManager>();
     sc            = FindObjectOfType <SpawnController>();
     aso           = gameObject.GetComponent <AudioSource>();
     sl            = FindObjectOfType <SoundLibrary>();
     statl         = FindObjectOfType <StatLibrary>();
     unit          = gameObject.GetComponent <Unit>();
     unit.SetDeadClip(sl.GetPlayerDead());
     ownedWeaponGOs = new List <GameObject>();
     previousWeapon = FindObjectOfType <PlayerWeapon>().name;
     ownedWeaponGOs.Add(sc.provideGameObject("BoneBag"));
 }
 void Start()
 {
     TMPweaponnum     = GameObject.FindGameObjectWithTag("TMPweaponnum").GetComponent <TextMeshPro>();
     weaponPickupPos  = GameObject.Find("WBPickupPos").transform.position;
     passivePickupPos = GameObject.Find("PAPUPos").transform.position;
     powerupPickupPos = GameObject.Find("PUPUPos").transform.position;
     playerUnit       = FindObjectOfType <Player>().GetComponent <Unit>();
     aso              = FindObjectOfType <Player>().GetComponent <AudioSource>();
     es               = SpawnsetEnemies.Load(epath);
     egl              = SpawnsetEnemies.Load(eglpath);
     ws               = WeaponSpawnset.Load(wpath);
     pus              = PowerupSpawnset.Load(poupath);
     pas              = PassiveSpawnset.Load(papath);
     statl            = FindObjectOfType <StatLibrary>();
     spawnList        = es.spawns;
     weaponList       = ws.weapons;
     paList           = pas.passives;
     pulist           = pus.powerups;
     EGLSpawnList     = egl.spawns;
     usedSpawnList    = new List <Spawn>();
     usedEGLSpawnList = new List <Spawn>();
     pickupSpawned    = FindObjectOfType <SoundLibrary>().GetPickupSpawned();
     fastmode         = playerUnit.gameObject.GetComponent <Player>().fastmode;
 }
Exemple #9
0
        //DONE
        public void OnPluginEnable()
        {
            try {
                //If the finalizer is still alive, inform the user and disable
                if (this._Finalizer != null && this._Finalizer.IsAlive) {
                    ConsoleError("Cannot enable plugin while it is shutting down. Please Wait.");
                    //Disable the plugin
                    this.Disable();
                    return;
                }
                //Create a new thread to activate the plugin
                this._Activator = new Thread(new ThreadStart(delegate {
                    try {
                        this.ConsoleWrite("Waiting a few seconds for requirements and other plugins to initialize, please wait...");
                        //Wait on all settings to be imported by procon for initial start, and for all other plugins to start and register.
                        for (Int32 index = 5; index > 0; index--) {
                            this.DebugWrite(index + "...", 1);
                            Thread.Sleep(1000);
                        }
                        //Initialize the stat library
                        this._StatLibrary = new StatLibrary(this);

                        //Don't directly depend on stat logger being controllable at this time, connection is unstable
                        /*if (this.useDatabase)
                        {
                            //Confirm Stat Logger active and properly configured
                            this.ConsoleWrite("Confirming proper setup for CChatGUIDStatsLoggerBF3, please wait...");

                            if (this.gameVersion == GameVersion.BF3)
                            {
                                if (this.confirmStatLoggerSetup())
                                {
                                    this.ConsoleSuccess("^bCChatGUIDStatsLoggerBF3^n enabled and active!");
                                }
                                else
                                {
                                    //Stat logger could not be enabled or managed
                                    this.ConsoleWarn("The stat logger plugin could not be found or controlled. Running AdKats in backup mode.");
                                    return;
                                }
                            }
                        }*/

                        //Inform of IP
                        this.ConsoleSuccess("Server IP is " + this._ServerIP + "!");

                        //Set the enabled variable
                        this._IsEnabled = true;

                        //Init and start all the threads
                        this.InitWaitHandles();
                        this.SetAllHandles();
                        this.InitThreads();
                        this.StartThreads();
                    }
                    catch (Exception e) {
                        this.HandleException(new AdKatsException("Error while enabling AdKats.", e));
                    }
                }));

                this.ConsoleWrite("^b^2Enabled!^n^0 Beginning startup sequence...");
                //Start the thread
                this._Activator.Start();
            }
            catch (Exception e) {
                this.HandleException(new AdKatsException("Error while initializing activator thread.", e));
            }
        }
Exemple #10
0
 public void SetSL(StatLibrary value)
 {
     sl = value;
 }
Exemple #11
0
        public void OnPluginEnable() {
            try {
                //If the finalizer is still alive, inform the user and disable
                if (_Finalizer != null && _Finalizer.IsAlive) {
                    ConsoleError("Cannot enable plugin while it is shutting down. Please Wait for it to shut down.");
                    Thread.Sleep(TimeSpan.FromSeconds(2));
                    //Disable the plugin
                    Disable();
                    return;
                }
                //Create a new thread to activate the plugin
                _Activator = new Thread(new ThreadStart(delegate {
                    try {
                        Thread.CurrentThread.Name = "enabler";

                        if ((DateTime.UtcNow - _proconStartTime).TotalSeconds < 10) {
                            ConsoleWrite("Waiting a few seconds for requirements and other plugins to initialize, please wait...");
                            //Wait on all settings to be imported by procon for initial start, and for all other plugins to start and register.
                            for (Int32 index = 5; index > 0; index--) {
                                DebugWrite(index + "...", 1);
                                Thread.Sleep(1000);
                            }
                        }

                        //Make sure the default in-game admin is disabled
                        ExecuteCommand("procon.protected.plugins.enable", "CInGameAdmin", "False");

                        //Initialize the stat library
                        _StatLibrary = new StatLibrary(this);

                        //Fetch all reputation information
                        PopulateCommandReputationDictionaries();

                        //Don't directly depend on stat logger being controllable at this time, connection is unstable
                        /*if (useDatabase)
                        {
                            //Confirm Stat Logger active and properly configured
                            ConsoleWrite("Confirming proper setup for CChatGUIDStatsLoggerBF3, please wait...");

                            if (gameVersion == GameVersion.BF3)
                            {
                                if (confirmStatLoggerSetup())
                                {
                                    ConsoleSuccess("^bCChatGUIDStatsLoggerBF3^n enabled and active!");
                                }
                                else
                                {
                                    //Stat logger could not be enabled or managed
                                    ConsoleWarn("The stat logger plugin could not be found or controlled. Running AdKats in backup mode.");
                                    return;
                                }
                            }
                        }*/

                        //Inform of IP
                        ConsoleSuccess("Server IP is " + _serverIP + "!");

                        //Set the enabled variable
                        _pluginEnabled = true;

                        //Init and start all the threads
                        InitWaitHandles();
                        SetAllHandles();
                        InitThreads();
                        StartThreads();
                    }
                    catch (Exception e) {
                        HandleException(new AdKatsException("Error while enabling AdKats.", e));
                    }
                    LogThreadExit();
                }));

                ConsoleWrite("^b^2Enabled!^n^0 Beginning startup sequence...");
                //Start the thread
                StartAndLogThread(_Activator);
            }
            catch (Exception e) {
                HandleException(new AdKatsException("Error while initializing activator thread.", e));
            }
        }
Exemple #12
0
    private void HandleDeath(Collider col)
    {
        if (IsDead())
        {
            //set layer to corpses layer
            foreach (Transform child in gameObject.GetComponentsInChildren <Transform>())
            {
                child.gameObject.layer = 10;
            }
            if (!gameObject.CompareTag("Player"))
            {
                GameObject anim = Instantiate(deathAnim, transform.position, Quaternion.identity);
                anim.GetComponentInChildren <ParticleSystem>();
                Destroy(anim, anim.GetComponentInChildren <ParticleSystem>().main.duration);
            }
            if (gameObject.CompareTag("Enemies") || gameObject.CompareTag("NecroSpawn") || gameObject.CompareTag("LichSpawn"))
            {
                Destroy(gameObject);
                GameObject soulinst = Instantiate(souls, transform.position, gameObject.transform.rotation);
                sc.SetTimeSinceLastKill(0);
            }
            if (gameObject.CompareTag("Friendlies"))
            {
                Destroy(gameObject);
                Player.CountFriends("Friendlies");
            }
            if (gameObject.CompareTag("Player"))
            {
                DisableWeaponRenderers();

                RawImage image    = GameObject.FindGameObjectWithTag("DeadImage").GetComponent <RawImage>();
                Color    newcolor = new Color();
                while (image.color.a < 0.8f)
                {
                    newcolor    = image.color;
                    newcolor.a += 0.01f;
                    image.color = newcolor;
                }
                if (sc.GetGameActive())
                {
                    uic.DisplayStats();
                    uic.DisplayHighScore();
                }
            }
            if (!gameObject.CompareTag("Player"))
            {
                gameObject.layer = 10;
                StatLibrary sl = FindObjectOfType <StatLibrary>();
                //Debug.Log("sl.GetDetrizide() = " + sl.GetDetrizide());
                //Debug.Log("col.gameObject.GetComponentInParent<Bullet>().GetParent().GetComponentInChildren<Gauntlets>() = " + col.gameObject.GetComponentInParent<Bullet>().GetParent().GetComponentInChildren<Gauntlets>());
                sl.SetDetrizide(sl.GetDetrizide() + detrizideGains);

                if (col.gameObject.GetComponentInParent <Bullet>())
                {
                    if (col.gameObject.GetComponentInParent <Bullet>().GetParent())
                    {
                        if (col.gameObject.GetComponentInParent <Bullet>().GetParent().GetComponentInChildren <Gauntlets>())
                        {
                            sl.SetDetrizide(sl.GetDetrizide() + detrizideGains);
                        }
                    }
                }
            }

            if (!hasDedSoundPlayed)
            {
                SoundLibrary.ResetPitch(GameObject.Find("Environment").GetComponent <AudioSource>());
                SoundLibrary.varySoundPitch(GameObject.Find("Environment").GetComponent <AudioSource>(), 0.2f);

                GameObject.Find("Environment").GetComponent <AudioSource>().clip = dead;
                GameObject.Find("Environment").GetComponent <AudioSource>().PlayOneShot(dead);
                hasDedSoundPlayed = true;
            }
        }
    }