Наследование: MonoBehaviour
            internal static void MigrateToVanjaro(PortalSettings PortalSettings)
            {
                TabInfo Tab = TabController.Instance.GetTab(PortalSettings.ActiveTab.TabID, PortalSettings.Current.PortalId);

                if (Tab != null && Tab.TabID > 0)
                {
                    try
                    {
                        Tab.SkinSrc      = "[g]skins/vanjaro/base.ascx";
                        Tab.ContainerSrc = "[g]containers/vanjaro/base.ascx";

                        using (VanjaroRepo db = new VanjaroRepo())
                        {
                            db.Execute(PortalScript.UpdateTabContainerSrc(PortalSettings.Current.PortalId, Tab.TabID));
                        }

                        //Clear Cache for all TabModules
                        foreach (ModuleInfo tabModule in ModuleController.Instance.GetTabModules(Tab.TabID).Values)
                        {
                            DataCache.RemoveCache(string.Format(DataCache.SingleTabModuleCacheKey, tabModule.TabModuleID));
                        }
                        DataCache.ClearModuleCache(Tab.TabID);

                        TabController.Instance.UpdateTab(Tab);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
    void MoveThroughPortals(string origin)
    {
        PortalScript firstPortalScript  = firstPortal.GetComponent <PortalScript>();
        PortalScript secondPortalScript = secondPortal.GetComponent <PortalScript>();

        GameObject rocket = GameObject.Find("Rocket");

        Vector3 exitVector   = new Vector3();
        Vector3 exitPosition = new Vector3();

        if (rocket == null)
        {
            return;
        }

        if (origin == firstPortal.name)
        {
            exitPosition = secondPortalScript.GetPortalPosition() + (portalExitDistance * secondPortalScript.GetExitVector());

            rocket.transform.position      = exitPosition;
            rocket.transform.localRotation = Quaternion.Euler(0, 0, 0);
        }
        else
        {
            exitPosition = firstPortalScript.GetPortalPosition() + (portalExitDistance * firstPortalScript.GetExitVector());

            rocket.transform.position      = exitPosition;
            rocket.transform.localRotation = Quaternion.Euler(0, 0, 0);
        }
    }
Пример #3
0
    private void Start()
    {
        lightingImageEffect_ = SceneGlobals.Instance.LightingImageEffect;
        startLight_          = LightingImageEffect.Instance.CurrentValues;
        baseAmbientColor_    = LightingImageEffect.Instance.CurrentValues.AmbientLight;
        ScaleAmbientLight(0.6f);
        nextFlash = Time.time + 2 + Random.value;

        CurrentRunData.Instance.Boss1Attempts++;

        golemKing_ = FindObjectOfType <GolemKingController>();

        miniGolems_ = FindObjectsOfType <MiniGolemController>();
        golems_     = FindObjectsOfType <GolemController>();
        for (int i = 0; i < golems_.Length; ++i)
        {
            golems_[i].gameObject.SetActive(false);
        }

        GameEvents.OnGolemKingCallingForHelp += GameEvents_OnGolemKingCallingForHelp;
        GameEvents.OnAllEnemiesKilled        += GameEvents_OnAllEnemiesKilled;

        nextLevelPortal_ = GameSceneLogic.Instance.NextLevelPortal;
        nextLevelPortal_.gameObject.SetActive(true);
        nextLevelPortal_.transform.position = Vector3.right * 800;

        Chest.SetActive(false);
    }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     Player = (GameObject) GameObject.FindWithTag ("Player");
     playerScript = (PlayerScript) Player.gameObject.GetComponent(typeof(PlayerScript));
     gameTime = 0;
     portalScript = (PortalScript) GameObject.Find("Portal").GetComponent(typeof(PortalScript));
 }
Пример #5
0
    // Use this for initialization
    void Start()
    {
        switch (exitDirection)
        {
        case Direction.LEFT:
            direction = new Vector3(-1, 0, 0);
            break;

        case Direction.RIGHT:
            direction = new Vector3(1, 0, 0);
            break;

        case Direction.UP:
            direction = new Vector3(0, 1, 0);
            break;

        case Direction.DOWN:
            direction = new Vector3(0, -1, 0);
            break;
        }

        if (!active)
        {
            return;
        }

        linkedPortalScript = linkedPortal.GetComponent <PortalScript> ();
        ////Debug.Log ("LPS " + linkedPortalScript);
        //scaledLinkedDirection = linkedDirection * 0.55f;



        ////Debug.Log (direction);
    }
Пример #6
0
 void Start()
 {
     S = this;
     initScale = transform.localScale;
     initBlocksNeeded = blocksNeeded;
     source = GetComponent<AudioSource> ();
 }
Пример #7
0
    private void Awake()
    {
        System.GC.Collect(0, System.GCCollectionMode.Forced, blocking: true, compacting: true);

        Instance = this;

        GameEvents.ClearListeners();
        GameEvents.OnEnemyKilled    += OnEnemyKilled;
        GameEvents.OnEnemySpawned   += OnEnemySpawned;
        GameEvents.OnPlayerDamaged  += OnPlayerDamaged;
        GameEvents.OnAutoPickUp     += OnAutoPickUp;
        GameEvents.OnAmmoChanged    += OnAmmoChanged;
        GameEvents.OnQuestCompleted += GameEvents_OnQuestCompleted;

        GameProgressData.CurrentProgress.QuestProgress.BeginQuestTracking();

        map_ = SceneGlobals.Instance.MapScript;

        NextLevelPortal = GameObject.FindWithTag("PurplePortal").GetComponent <PortalScript>();
        NextLevelPortal.gameObject.SetActive(false);
        NextLevelPortal.OnPlayerEnter.AddListener(OnPlayerEnterNextLevelPortal);

        BossPortal = GameObject.FindWithTag("GreenPortal").GetComponent <PortalScript>();
        BossPortal.gameObject.SetActive(false);
        BossPortal.OnPlayerEnter.AddListener(OnPlayerEnterBossPortal);
    }
Пример #8
0
    public void SetupRoom(RoomScript room)
    {
        if (m_sourcePortal)
        {
            //PortalScript destPortal = room.m_Portals[0];

            /*
             * This is going to find the portal in the new room that matches
             * the portals tag of the old room
             */
            PortalScript destPortal = FindObjectByTag(room.m_Portals, m_sourcePortal.tag);
            Debug.Log(destPortal);

            if (destPortal)
            {
                destPortal.m_LinkedPortal     = m_sourcePortal;
                m_sourcePortal.m_LinkedPortal = destPortal;

                room.transform.rotation = Quaternion.LookRotation(
                    destPortal.transform.InverseTransformDirection(-m_sourcePortal.transform.forward),
                    destPortal.transform.InverseTransformDirection(m_sourcePortal.transform.up));
                room.transform.position = m_sourcePortal.transform.position + (room.transform.position - destPortal.transform.position);

                m_sourcePortal = null;
            }
        }

        m_loadingLevel = false;
    }
Пример #9
0
    // Use this for initialization
    void Start()
    {
        pc = transform.parent.parent.GetComponent<PlayerController>();
        meter = transform.Find("meter").GetComponent<Image>();

        manager = GameObject.Find("Manager").GetComponent<Manager>();
        portal = GameObject.FindGameObjectWithTag("Portal").GetComponent<PortalScript>();
    }
Пример #10
0
    private void OnTriggerExit2D(Collider2D other)
    {
        GameObject   portal = GameObject.Find(this.name.Replace("-Button", ""));
        PortalScript ps     = portal.GetComponent <PortalScript> ();

        ps.portalOpen = false;
        portal.GetComponent <SpriteRenderer>().color = new Color(100, 0, 0);
    }
Пример #11
0
    // Use this for initialization
    void Start()
    {
        pc    = transform.parent.parent.GetComponent <PlayerController>();
        meter = transform.Find("meter").GetComponent <Image>();

        manager = GameObject.Find("Manager").GetComponent <Manager>();
        portal  = GameObject.FindGameObjectWithTag("Portal").GetComponent <PortalScript>();
    }
Пример #12
0
 public static bool Prefix(PortalScript __instance, int ___biome, ref string __result)
 {
     if (PlanetRegistry.Singleton.HasEntry(___biome))
     {
         __result = PlanetRegistry.Singleton.GetEntry(___biome).Name;
         return(false);
     }
     return(true);
 }
 public static bool Prefix(PortalScript __instance, ref int a)
 {
     if (!GadgetNetwork.MatrixReady && GadgetNetwork.GetTimeSinceConnect() < GadgetNetwork.MatrixTimeout)
     {
         __instance.StartCoroutine(GadgetUtils.WaitAndInvoke(RPCMethod, GadgetNetwork.MatrixTimeout - GadgetNetwork.GetTimeSinceConnect(), () => GadgetNetwork.MatrixReady, __instance, a));
         return(false);
     }
     GadgetNetwork.ConvertIDToLocal(PlanetRegistry.Singleton, ref a);
     return(true);
 }
Пример #14
0
 void Awake()
 {
     if (player)
     {
         portalScript = GameObject.Find("Portals").GetComponent <PortalScript>();
     }
     else
     {
         portalScript = GameObject.Find("PortalsP2").GetComponent <PortalScript>();
     }
 }
Пример #15
0
    void PortalSpawn()
    {
        portalObj = Instantiate(portalPrefab, spawnPoints[Random.Range(0, spawnPoints.Length)].position, Quaternion.identity);

        portalObj.transform.position = new Vector3(portalObj.transform.position.x, portalObj.transform.position.y, 0);

        PortalScript portalSc = portalObj.GetComponent <PortalScript>();

        portalSc._attackBtn = GameObject.FindGameObjectWithTag("AttackButton");

        portalObj.SetActive(false);
    }
Пример #16
0
            private static void UpdatePortalSettings(List <StringValue> SettingNameValue, int PortalID, int UserID)
            {
                string query = string.Empty;

                foreach (StringValue setting in SettingNameValue)
                {
                    query += PortalScript.UpdatePortalSettings(setting.Text, setting.Value, PortalID, UserID);
                }

                using (VanjaroRepo db = new VanjaroRepo())
                {
                    db.Execute(query);
                }
            }
Пример #17
0
    void OnTriggerExit2D(Collider2D other)
    {
        if (gameManager.gameState != GameState.Playing)
        {
            return;
        }

        if (other.gameObject.tag == "Portal")
        {
            PortalScript portalScript = other.GetComponent <PortalScript> ();
            portalScript.UnlockPortal();
        }
        else if (other.gameObject.tag == "AccelZone")
        {
            acceleration = 1.0f;
        }
    }
Пример #18
0
    /*
     * So this is where the next room gets loaded and the source portal
     * gets set. After this setup room gets called once the room spawns
     * so that the source portal then looks for a destination portal.
     *
     * However, the idea is that we can actually set the destination portal
     * from the portal script and then that will take care of which one we go
     * to
     */
    public void LoadRoom(PortalScript portal)
    {
        int levelIndex;

        if (portal == null)
        {
            levelIndex = 1;
        }
        else
        {
            levelIndex = portal.m_destRoomID;
        }

        SceneManager.LoadScene(levelIndex, LoadSceneMode.Additive);
        m_loadingLevel = true;
        m_sourcePortal = portal;
    }
Пример #19
0
    public override void ApplyToMap(Vector3Int position)
    {
        ApplyTilemap(position);
        nextLevelPortal_ = GameSceneLogic.Instance.NextLevelPortal;
        nextLevelPortal_.gameObject.SetActive(true);
        nextLevelPortal_.transform.position = PortalPosition.position;

        bool showBossPortal = CurrentRunData.Instance.FloorInWorld > CurrentRunData.BossActivationFloor;

        if (CurrentRunData.Instance.World != World.World1)
        {
            showBossPortal = false; // TODO: Remove when there is a boss for world two
        }
        bossPortal_ = GameSceneLogic.Instance.BossPortal;
        bossPortal_.gameObject.SetActive(showBossPortal);
        bossPortal_.transform.position = BossPortalPosition.position;
    }
Пример #20
0
 // Use this for initialization
 void Start()
 {
     maxCountCreature = 0;
     portal = (PortalScript)FindObjectOfType(typeof(PortalScript));
     /*
     progressTimers [0] = 5f;
     progressTimers [1] = 15f;
     progressTimers [2] = 45f;
     progressTimers [3] = 80f;
     progressTimers [4] = 120f;
     progressTimers [5] = 160f;
     progressTimers [6] = 250f;
     progressTimers [7] = 350f;
     progressTimers [8] = 450f;
     progressTimers [9] = 580f;
     progressTimers [10] = 640f;
     */
 }
Пример #21
0
 void OnCollisionEnter(Collision col)
 {
     //Debug.Log("working");
     if (col.gameObject.tag.Equals("attack"))
     {
         Destroy(col.gameObject);
         if (player)
         {
             PortalScript ps = GameObject.Find("Portals" + "P2").GetComponent <PortalScript>();
             ps.attackSpawn(number);
         }
         else
         {
             PortalScript ps = GameObject.Find("Portals" + "").GetComponent <PortalScript>();
             ps.attackSpawn(number);
         }
     }
 }
Пример #22
0
    // Use this for initialization
    void Start()
    {
        maxCountCreature = 0;
        portal           = (PortalScript)FindObjectOfType(typeof(PortalScript));

        /*
         * progressTimers [0] = 5f;
         * progressTimers [1] = 15f;
         * progressTimers [2] = 45f;
         * progressTimers [3] = 80f;
         * progressTimers [4] = 120f;
         * progressTimers [5] = 160f;
         * progressTimers [6] = 250f;
         * progressTimers [7] = 350f;
         * progressTimers [8] = 450f;
         * progressTimers [9] = 580f;
         * progressTimers [10] = 640f;
         */
    }
Пример #23
0
 public static void EnterScriptedPortal(WzMap.Portal portal, MapleCharacter character)
 {
     if (!string.IsNullOrEmpty(portal.Script))
     {
         Type portalScriptType;
         if (DataBuffer.PortalScripts.TryGetValue(portal.Script, out portalScriptType) && portalScriptType != null)
         {
             PortalScript scriptInstance = Activator.CreateInstance(portalScriptType) as PortalScript;
             if (scriptInstance == null)
             {
                 string error = string.Format("Error loading {0} {1}", "PortalScript", portal.Script);
                 ServerConsole.Error(error);
                 FileLogging.Log("Portal scripts", error);
                 return;
             }
             scriptInstance.Character = new ScriptCharacter(character, portal.Script);
             try
             {
                 scriptInstance.Execute();
             }
             catch (Exception e)
             {
                 string error = string.Format("Script: {0} error: {1}", portal.Script, e);
                 FileLogging.Log("Portal scripts", error);
                 ServerConsole.Debug("Portal script execution error: " + error);
                 character.EnableActions();
             }
         }
         else
         {
             character.SendBlueMessage(string.Format("This portal is not coded yet (mapId: {0}, portalId: {1}, script name: {2})", character.MapId, portal.Id, portal.Script));
             character.EnableActions();
         }
     }
     else
     {
         character.EnableActions();
     }
 }
Пример #24
0
 void OnTriggerStay2D(Collider2D other)
 {
     if (gameManager.gameState != GameState.Playing)
     {
         return;
     }
     if (!gameManager.isWinning && other.gameObject.tag == (currentType.ToString() + "Hole"))
     {
         Debug.Log("win");
         endDestination = other.gameObject.transform.position;
         gameManager.changeGameState(GameState.EndingAnimation);
         gameManager.isWinning = true;
     }
     else if (other.gameObject.tag == "Mechanism")
     {
         MechanicScript mechScript = other.GetComponent <MechanicScript> ();
         if (mechScript.type == currentType)
         {
             mechScript.ActivateMechanic();
         }
     }
     else if (other.gameObject.tag == "Portal")
     {
         PortalScript portalScript = other.GetComponent <PortalScript> ();
         if (portalScript.type == currentType)
         {
             if (acceleration == 2.0f)
             {
                 acceleration = 1.0f;
             }
             portalScript.UsePortal(this.gameObject);
         }
     }
     else if (other.gameObject.tag == "AccelZone" && acceleration == 1.0f)
     {
         acceleration = 2.0f;
     }
 }
Пример #25
0
        void SingleGeneration(GameObject border, PortalScript lastPortal, Direction direction)
        {
            //Set Material
            int i = Random.Range(0, mapColor.Count - UseMaterial.Count);

            border.GetComponent <MeshRenderer>().material = mapColor[i];
            TailMapGeneration(border);

            PortalScript nextportal = null;

            foreach (PortalScript game in border.GetComponentsInChildren <PortalScript>())
            {
                if (nextportal == null)
                {
                    nextportal = game;
                }
                if (game.transform.position.y > nextportal.transform.position.y)
                {
                    nextportal = game;
                }
            }
            lastPortal.Destination = nextportal;
        }
Пример #26
0
        public void SetScriptedField(Packet inPacket)
        {
            string portalLabel = inPacket.ReadString();
            Portal portal      = this.Field.Portals[portalLabel];

            if (portal == null || portal.DestinationFieldID != 999999999)
            {
                return;
            }

            this.Release();

            if (GameServer.Scripts[ScriptType.Portal].ContainsKey(portal.Label))
            {
                PortalScript script = (PortalScript)Activator.CreateInstance(GameServer.Scripts[ScriptType.Portal][portal.Label]);

                script.Initiate(this);
                script.Run();
            }
            else
            {
                MainForm.Instance.Log("Character '{0}' tried to go through an unimplemented Portal '{1}'.", this.Name, portal.Label);
            }
        }
Пример #27
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Portal")
        {
            GameObject sourcePortal = collision.gameObject;

            if (sourcePortal.GetComponent <PortalScript>().active)
            {
                List <GameObject> portals     = GameObject.FindObjectOfType <GameController>().portals;
                List <GameObject> tempPortals = new List <GameObject>(portals);
                tempPortals.Remove(sourcePortal);
                int          index             = Random.Range(0, tempPortals.Count);
                GameObject   destinationPortal = tempPortals[index];
                PortalScript destScript        = destinationPortal.GetComponent <PortalScript>();
                destScript.active  = false;
                transform.position = destinationPortal.transform.position;

                if (destScript.horizontal)
                {
                    if (Random.Range(0, 2) == 0)
                    {
                        destScript.exitRight = true;
                    }
                    else
                    {
                        destScript.exitRight = false;
                    }
                }

                if (destScript.vertical)
                {
                    if (Random.Range(0, 2) == 0)
                    {
                        destScript.exitUp = true;
                    }
                    else
                    {
                        destScript.exitUp = false;
                    }
                }

                double rotationDegrees = 0;

                if (destScript.exitRight && destScript.horizontal)
                {
                    rotationDegrees = 0;
                }
                if (!destScript.exitRight && destScript.horizontal)
                {
                    rotationDegrees = 180;
                }

                if (destScript.exitUp && destScript.vertical)
                {
                    rotationDegrees = 90;
                }
                if (!destScript.exitUp && destScript.vertical)
                {
                    rotationDegrees = 270;
                }

                float xMagnitude = (float)System.Math.Cos((System.Math.PI / 180) * rotationDegrees);
                float yMagnitude = (float)System.Math.Sin((System.Math.PI / 180) * rotationDegrees);

                GetComponent <Rigidbody2D>().velocity = new Vector2(projectileSpeed * xMagnitude, projectileSpeed * yMagnitude);
            }
        }

        if (collision.tag == "Wall")
        {
            ExplodeAnimation();
        }

        if (collision.tag == "Player" && collision.gameObject != player)
        {
            Destroy(gameObject);
            collision.GetComponent <CharacterController>().hp--;
            if (player != null)
            {
                player.GetComponent <CharacterController>().glow.SetActive(false);
            }
        }
    }
Пример #28
0
 protected sealed override void OnPreRender(EventArgs e)
 {
     PortalScript.RegisterClientScriptBlock(typeof(PortalView), "appPath", "    p$.relativeAppPath = '" + Portal.HttpContext.Request.ApplicationPath + "';");
 }
Пример #29
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Portal")
        {
            GameObject   sourcePortal = collision.gameObject;
            PortalScript sourceScript = sourcePortal.GetComponent <PortalScript>();

            if (sourceScript.active)
            {
                audio.PlayOneShot(teleport);
                if (transform.position.x < sourcePortal.transform.position.x)
                {
                    sourceScript.enter_left[id - 1].SetActive(true);
                }
                else
                {
                    sourceScript.enter_left[id - 1].SetActive(true);
                }

                sourceScript.bounds.SetActive(false);
                List <GameObject> portals     = GameObject.FindObjectOfType <GameController>().portals;
                List <GameObject> tempPortals = new List <GameObject>(portals);
                tempPortals.Remove(sourcePortal);
                int          index             = Random.Range(0, tempPortals.Count);
                GameObject   destinationPortal = tempPortals[index];
                PortalScript destScript        = destinationPortal.GetComponent <PortalScript>();
                destScript.active  = false;
                transform.position = destinationPortal.transform.position;

                if (destScript.horizontal)
                {
                    if (Random.Range(0, 2) == 0)
                    {
                        destScript.exitRight = true;
                        destScript.exit_right[id - 1].SetActive(true);
                    }
                    else
                    {
                        destScript.exitRight = false;
                        destScript.exit_left[id - 1].SetActive(true);
                    }
                }

                if (destScript.vertical)
                {
                    if (Random.Range(0, 2) == 0)
                    {
                        destScript.exitUp = true;
                    }
                    else
                    {
                        destScript.exitUp = false;
                    }
                }

                autoMove = true;

                if (destScript.horizontal)
                {
                    if (destScript.exitRight)
                    {
                        autoMoveX = 1f;
                    }

                    if (!destScript.exitRight)
                    {
                        autoMoveX = -1f;
                    }
                }

                if (destScript.vertical)
                {
                    if (destScript.exitUp)
                    {
                        autoMoveY = 1f;
                    }

                    if (!destScript.exitUp)
                    {
                        autoMoveY = -1f;
                    }
                }

                sourceScript.bounds.SetActive(true);
                sourcePortal.GetComponentInParent <Animator>().SetBool("Open", false);
            }
        }

        if (collision.tag == "PickUp")
        {
            item  = collision.GetComponent <ItemBehaviour>().itemName;
            ammo += 10;

            Destroy(collision.gameObject);

            GameObject.FindObjectOfType <GameController>().GetComponent <ItemSpawner>().itemsCount--;
        }

        if (collision.tag == "PortalBounds")
        {
            collision.gameObject.GetComponentInParent <Animator>().SetBool("Open", true);
        }
    }
Пример #30
0
    public virtual void UpdatePortals()
    {
        //gets player data from database
        string Levelname = gc.currLevel.ToString();

        RestClient.Get <LevelData>("https://time-bind.firebaseio.com/TimeBind/" + gc.key + "/" + Levelname + "/" + "Player" + ((int)gc.playerType + 1) + ".json").Then(response =>
        {
            //having all this could in this then section makes sure all of this is executed in order
            currsaves[(int)gc.playerType] = response;

            //if the flag is set look through the portal list to see if a change has happened
            if (currsaves[(int)gc.playerType].getItem(0) == 1)
            {
                if (currsaves[(int)gc.playerType].getItem(1) == 1)
                {
                    gc.DeathTrigger();
                    currsaves[(int)gc.playerType].setItem(1, 0);
                }
                else if (currsaves[(int)gc.playerType].getItem(2) == 1)
                {
                    int who = 2;
                    Debug.Log("test");
                    switch ((int)gc.playerType + 1)
                    {
                    case 1:
                        who = 2;
                        break;

                    case 2:
                        who = 1;
                        break;
                    }
                    playerWin[who - 1] = true;
                    currsaves[(int)gc.playerType].setItem(2, 0);
                }

                else
                {
                    //if any portal in portal list has an item value greater then 1 generate the item at the portal with the same id - 1
                    for (int i = 3; i < currsaves[(int)gc.playerType].getListLength(); i++)
                    {
                        if (currsaves[(int)gc.playerType].getItem(i) > 1)
                        {
                            int item            = currsaves[(int)gc.playerType].getItem(i);
                            PortalScript portal = portals[i - 3].GetComponent <PortalScript>();
                            portal.generateItem(currsaves[(int)gc.playerType].getItem(i) - 2);
                            currsaves[(int)gc.playerType].setItem(i, 0);
                        }
                        else if (currsaves[(int)gc.playerType].getItem(i) == 1)
                        {
                            int item            = currsaves[(int)gc.playerType].getItem(i);
                            SwitchPortal portal = portals[i - 3].GetComponent <SwitchPortal>();
                            portal.indieToggleSwitch();
                            currsaves[(int)gc.playerType].setItem(i, 0);
                        }
                    }
                }
                //clears the flags and sends the new save data to the database to be stored
                currsaves[(int)gc.playerType].setItem(0, 0);
                SendSave((int)gc.playerType + 1, currsaves[(int)gc.playerType]);
                preventrepeat = false;
            }
        }).Catch(ex =>
        {
            currsaves[(int)gc.playerType] = new LevelData();
            SendSave((int)gc.playerType + 1, new LevelData());
        });
    }
Пример #31
0
 void Awake()
 {
     portalScript = GameObject.Find("Portals").GetComponent <PortalScript>();
 }
Пример #32
0
 private void Start()
 {
     Instance = this;
 }
Пример #33
0
    void OnTriggerEnter(Collider col)
    {
        //COLLECT CHARGES
        if (col.gameObject.tag == "Charge")
        {
            ChargeScript chargeScript = col.GetComponent <ChargeScript>();
            //Makes sure that the charge isn't collected twice on accident
            if (chargeScript.isCollected == false)
            {
                chargeScript.isCollected = true;
                if (ValueHolder.music)
                {
                    soundEffects[0].Play();
                }

                Destroy(col.gameObject);
                charges++;
                //Update the charge bar to reflect the new charge.
                chargeBarDisplay.GetComponent <ChargeBarDisplay>().UpdateText();
            }
        }

        //KNOCK THE BUCKET OFF
        if (col.gameObject.tag == "Bucket Trigger")
        {
            bucket.GetComponent <BucketScript>().activate();
        }

        //TELEPORT VIA THE PORTALS
        if (col.gameObject.tag == "Portal")
        {
            soundEffects[1].Play();
            PortalScript portal = col.gameObject.GetComponent <PortalScript>();
            gameObject.GetComponent <Transform>().position = new Vector3(portal.targetX, portal.targetY, portal.targetZ);
        }

        //ACTIVATE A CHECKPOINT
        if (col.gameObject.tag == "Checkpoint")
        {
            soundEffects[1].Play();

            Checkpoint ch = col.gameObject.GetComponent <Checkpoint>();

            if (ch.number > ValueHolder.checkpointNumber)
            {
                ValueHolder.checkpointNumber = ch.number;
                Debug.Log("CHECKPOINT " + ValueHolder.checkpointNumber);
            }

            for (int i = 0; i <= ch.number; i++)
            //for every checkpoint less than or equal to the checkpoint just passed through, light it up
            {
                GameObject check = checkpoints[i];
                check.GetComponent <Checkpoint>().lightOn();
            }

            //Update the charge bar to reflect the new level - a different number of charges is required to time travel
            chargeBarDisplay.GetComponent <ChargeBarDisplay>().UpdateText();
        }

        //COLLECT RUM
        if (col.gameObject.tag == "Rum")
        {
            soundEffects[3].Play();
            Destroy(col.gameObject);
            if (health < 3)
            {
                gameObject.GetComponentInParent <PlayerScript>().health++;
                healthDisplayer.GetComponent <HealthBarDisplay>().UpdateText();
            }
        }
    }
Пример #34
0
    // Refactor this so that GameObject is an entity of some type and does its own thing
    public void ApplyToGameObject(GameObject go)
    {
        if (this.type == FrEdLibrary.Type.Buffalo)
        {
            GoomaScript buffalo = go.GetComponent <GoomaScript>();
            buffalo.speed          = this.speed;
            buffalo.checkForFloors = this.checkFloor;
            buffalo.move           = buffalo.speed != 0.0f;
            if (!buffalo.move)
            {
                buffalo.checkForFloors = false;
                this.checkFloor        = false;
            }
        }

        if (this.type == FrEdLibrary.Type.MovingSpikePlatform)
        {
            NovaMovingBlock block = go.GetComponent <NovaMovingBlock>();
            //block.InitFromEditor(this.nodePos, this.speed, this.easing);
        }

        //apply stats for decoration
        if (this.type == FrEdLibrary.Type.Decoration)
        {
            if (this.aniId != -1)
            {
                FrEdAniScript aniScript  = go.AddComponent <FrEdAniScript>();
                FrEdInfo      infoScript = go.GetComponent <FrEdInfo>();
                aniScript.go         = infoScript.puppet;
                aniScript.meshFilter = aniScript.go.GetComponent <MeshFilter>();
                aniScript.aniId      = this.aniId;
            }
        }

        //apply stats for particle system
        if (this.type == FrEdLibrary.Type.Particles)
        {
            ParticleSystem ps = go.GetComponentInChildren <ParticleSystem>();
            var            em = ps.emission;
            em.rateOverTime = this.emissionPerSecond;

            var ma = ps.main;
            var sz = ma.startSize;
            sz.mode        = ParticleSystemCurveMode.TwoConstants;
            sz.constantMin = this.startSizeMin;
            sz.constantMax = this.startSizeMax;
            ma.startSize   = sz;
            //Debug.Log("setting size: " + this.startSizeMin + ", " + this.startSizeMax);

            var sp = ma.startSpeed;
            sp.constantMin = this.startSpeedMin;
            sp.constantMax = this.startSpeedMax;
            sp.mode        = ParticleSystemCurveMode.TwoConstants;
            ma.startSpeed  = sp;

            var lf = ma.startLifetime;
            lf.constantMin   = this.startLifespanMin;
            lf.constantMax   = this.startLifespanMax;
            lf.mode          = ParticleSystemCurveMode.TwoConstants;
            ma.startLifetime = lf;

            var sh = ps.shape;
            sh.shapeType = this.shape;
            sh.scale     = this.shapeScale;

            var cl = ps.colorOverLifetime;
            cl.enabled = true;
            Gradient grad = new Gradient();
            grad.SetKeys(
                new GradientColorKey[] {
                new GradientColorKey(this.color1, 0.0f),
                new GradientColorKey(this.color2, 1.0f)
            },
                new GradientAlphaKey[] {
                new GradientAlphaKey(this.alpha1, 0.0f),
                new GradientAlphaKey(this.alpha2, 0.25f),
                new GradientAlphaKey(this.alpha3, 0.5f),
                new GradientAlphaKey(this.alpha4, 0.75f),
                new GradientAlphaKey(this.alpha5, 1.0f)
            }
                );
            cl.color = grad;

            var rt = ps.rotationOverLifetime;
            rt.enabled      = true;
            rt.separateAxes = true;
            var rtz = rt.z;
            rtz.constantMin = this.rotationMin;
            rtz.constantMax = this.rotationMax;
            rtz.mode        = ParticleSystemCurveMode.TwoConstants;
            rt.z            = rtz;

            ParticleSystemRenderer psr = go.GetComponentInChildren <ParticleSystemRenderer>();
            psr.mesh = FrEdLibrary.instance.GetMesh(this.mesh);
        }

        //apply stats for camera trigger
        if (this.type == FrEdLibrary.Type.CameraTrigger)
        {
            SetStateCameraState script = go.GetComponentInChildren <SetStateCameraState>();
            script.state       = this.cameraState;
            script.pos.x       = this.nodePos.x;
            script.pos.y       = this.nodePos.y;
            script.scrollSpeed = this.speed;
            script.trackXOrY   = this.track;
            script.minX        = this.min.x;
            script.maxX        = this.max.x;
            script.minY        = this.min.y;
            script.maxY        = this.max.y;

            script.setState       = true;
            script.setPos         = true;
            script.setScrollSpeed = true;
            script.setTrackXOrY   = true;
            script.setMinX        = true;
            script.setMaxX        = true;
            script.setMinY        = true;
            script.setMaxY        = true;
        }

        //apply stats for firestick
        if (this.type == FrEdLibrary.Type.Firestick)
        {
            Rotate2Script script = go.GetComponentInChildren <Rotate2Script>();
            script.speed.z = this.speed;
        }

        //apply stats for laser
        if (this.type == FrEdLibrary.Type.Laser)
        {
            Rotate2Script script = go.GetComponent <Rotate2Script>();
            script.speed.z = this.speed;
        }

        //apply stats for quadlaser
        if (this.type == FrEdLibrary.Type.QuadLaser)
        {
            Rotate2Script script = go.GetComponent <Rotate2Script>();
            script.speed.z = this.speed;
        }

        //apply stats for frog
        if (this.type == FrEdLibrary.Type.Frog)
        {
            FrEdFrogScript frogScript = go.GetComponent <FrEdFrogScript>();
            frogScript.ammoId = this.ammoId;
            frogScript.delay  = this.firingDelay;
        }

        //set speed & lifespan for ninja stars
        if (this.type == FrEdLibrary.Type.NinjaStar)
        {
            //Debug.Log("APPLYING NINJA STAR STATS");
            FreshBulletScript freshBulletScript = go.GetComponent <FreshBulletScript>();
            freshBulletScript.speed    = this.speed;
            freshBulletScript.lifespan = this.lifespan;
        }

        //set speed & lifespan for missiles
        if (this.type == FrEdLibrary.Type.HomingMissile ||
            this.type == FrEdLibrary.Type.SpikyHomingMissile)
        {
            FreshHomingMissileScript homingMissileScript = go.GetComponent <FreshHomingMissileScript>();
            homingMissileScript.slowMissile       = false;
            homingMissileScript.speed             = this.speed;
            homingMissileScript.lifespanInSeconds = this.lifespan;
            homingMissileScript.turnSpeed         = this.turningSpeed;
            homingMissileScript.lockToThisZ       = this.zPos;
        }

        //set tilt
        if (this.type != FrEdLibrary.Type.Block)
        {
            go.transform.SetAngZ(this.tilt);
        }

        //set scale
        go.transform.SetScaleX(this.scale.x);
        go.transform.SetScaleY(this.scale.y);

        //Destination level
        if (this.type == FrEdLibrary.Type.Portal)
        {
            PortalScript portalScript = go.GetComponent <PortalScript>();
            if (portalScript != null)
            {
                bool   isButtLevel = !string.IsNullOrEmpty(this.destinationButt);
                string level       = (isButtLevel)? this.destinationButt : this.destinationLevel;
                portalScript.Initialize(level, isButtLevel, this.noSound);
            }
        }

        //set generic info stats
        FrEdInfo info = go.GetComponent <FrEdInfo>();

        if (info != null)
        {
            info.int1 = this.int1;
            info.set  = true;
        }
    }