Inheritance: MonoBehaviour
Example #1
0
 // Use this for initialization
 void Start()
 {
     // Find the GameManager object
     manager = GameObject.Find ("GameManager").GetComponent<GameScript>();
     // Write the current level in the GameManager
     manager.lastLevelPlayed = levelValue;
 }
    void Start()
    {
        gameScript =
            GameObject.FindWithTag( TAGS.WORLD ).GetComponent< GameScript >();

        objMaterial = renderer.material;
    }
Example #3
0
	void Start()
	{
		
		m_gameScript = (GameScript)GameObject.FindObjectOfType(typeof(GameScript));		
		
		
		#if PHOTON_MULTIPLAYER
		
			//we are offline lets hide the start button, otherwise lets hide the wait button.
			if(PhotonNetwork.offlineMode==false)
			{
				startButtonGO.SetActive(false);
			}else{
				waitGO.SetActive(false);
			}
			if(ConnectManager.Instance && ConnectManager.Instance.getStartedHole())
			{
				waitGO.SetActive(false);
				
				startButtonGO.SetActive(true);
				
			}
		
		#else
		if(waitGO)
		{
			waitGO.SetActive(false);
		}
		#endif
		int holeIndex = m_gameScript.getHoleNomUsingCourse();
		holeGT.text = holeIndex.ToString();
		
		
	}
    void Start()
    {
        speed = 0;
        state = "off";
        game = (GameScript)  GameObject.Find("GameScript").GetComponent(typeof(GameScript));

        airplane = GameObject.Find ("Cessna").transform.position;
    }
 public GameScript GiveMeTheOtherPlayer(GameScript me)
 {
     foreach(GameScript you in games) {
         if (you != me ){
             return you;
         }
     }
     return null;
 }
 void Start()
 {
     sound = GetComponent<AudioSource>();
     GetComponent<Button>().onClick.AddListener(() => OnClick());
     gameScript = GameObject.Find("Main Camera").GetComponent<GameScript>();
     image = GetComponent<Image>();
     originalColor = image.color;
     activeColor = Color.grey;
 }
    void Start()
    {
        motor =
            GetComponent< CharacterMotor >();

        configScript = GameScript.GetConfig();

        gameScript =
            GameObject.FindWithTag( TAGS.WORLD ).GetComponent< GameScript >();
    }
Example #8
0
	void Start()
	{
		
		m_gameScript = (GameScript)GameObject.FindObjectOfType(typeof(GameScript));		
		#if PHOTON_MULTIPLAYER
		
		if(PhotonNetwork.offlineMode)
		{
			Destroy(GameObject.Find("CLOCK"));
		}
		#endif
	}
Example #9
0
 // Use this for initialization
 void Start()
 {
     gameScript = FindObjectOfType<Camera>().GetComponent<GameScript>();
     squares[0, 0] = cube1.GetComponent<CubeScript>().value;
     squares[0, 1] = cube2.GetComponent<CubeScript>().value;
     squares[0, 2] = cube3.GetComponent<CubeScript>().value;
     squares[1, 0] = cube4.GetComponent<CubeScript>().value;
     squares[1, 1] = cube5.GetComponent<CubeScript>().value;
     squares[1, 2] = cube6.GetComponent<CubeScript>().value;
     squares[2, 0] = cube7.GetComponent<CubeScript>().value;
     squares[2, 1] = cube8.GetComponent<CubeScript>().value;
     squares[2, 2] = cube9.GetComponent<CubeScript>().value;
 }
 void Awake()
 {
     // Only keep one of these around
     if (instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         instance = this;
     }
     else if(instance != this)
     {
         Destroy(this.gameObject);
     }
 }
Example #11
0
	public void Start()
	{
		#if PHOTON_MULTIPLAYER
		if(PhotonNetwork.offlineMode==false)
		{
			Destroy(mainMenuGO);
		}
		#endif
		//get out gamescript component
		GameObject go = GameObject.FindWithTag("Game");
		if(go)
		{
			m_gameScript = go.GetComponent<GameScript>();
		}
	}
Example #12
0
    void Start()
    {
        gameSpawn =
            GameObject.FindWithTag( TAGS.SPAWN ).transform;

        gameScript =
            GameObject.FindWithTag( TAGS.WORLD ).GetComponent< GameScript >();

        SpawnPlayer();

        mainCamera =
            GameObject.FindWithTag( TAGS.MAIN_CAMERA ).GetComponent< Camera >();

        shootTimer = 0.0f;
    }
    // Use this for initialization
    void Start()
    {
        characterController = GetComponent<CharacterController>();
        game = GameObject.Find("GAME");
        gameScript = game.GetComponent<GameScript>();
        player = gameScript.Player.gameObject;
        animator = transform.FindChild("zombi1animated").gameObject.GetComponent<Animator>();

        target = player.transform.position;

        target.y = transform.position.y;
        animator.SetBool("walking1", Random.Range(0, 2) == 0 ? true : false);
        Debug.Log("walking1: " + animator.GetBool("walking1"));
        move = true;
    }
Example #14
0
	public void Start()
	{
		#if PHOTON_MULTIPLAYER

		//if we are offline or have no opponet then lets hide the results.
		if(PhotonNetwork.offlineMode || Misc.haveOpponent()==false)
		{
			resultGO.SetActive(false);
		}
#endif
		//get out gamescript component
		GameObject go = GameObject.FindWithTag("Game");
		if(go)
		{
			m_gameScript = go.GetComponent<GameScript>();
		}
	}
Example #15
0
    void Awake()
    {
        instance = this;

        gameScript = FindObjectOfType<GameScript>();

        foreach (var goal in FindObjectsOfType<GoalScript>())
        {
          goal.OnGoal += Goal;
        }

        score1.text = "0";
        score2.text = "0";
        player1.text = "";
        player2.text = "";

        instance.gameOverPanel.SetActive(false);
    }
Example #16
0
    public static void Load(string path, GameScript gameScript)
    {
        var serializer = new XmlSerializer (typeof(GameSaverScript));
        GameSaverScript loader;
        using (var stream = new FileStream(path, FileMode.Open)) {
            loader = serializer.Deserialize (stream) as GameSaverScript;
        }
        //Set values from saver scripts
        loader.grid.Restore (gameScript);
        gameScript.myname = loader.myname;
        gameScript.opponentname = loader.opponentname;
        gameScript.turn = loader.turn;
        gameScript.myPlayerType = loader.myPlayerType;
        gameScript.winner = loader.winner;
        gameScript.curGameState = loader.curGameState;

        gameScript.rpcScript.SetTurn (loader.myname);

        XmlSerializer baseSerialize = new XmlSerializer(typeof(BaseSaverScript));

        XmlSerializer serialize = new XmlSerializer(typeof(ShipSaverScript));
        XmlWriterSettings settings = new XmlWriterSettings();
        settings.Encoding = new UnicodeEncoding(false, false);
        settings.Indent = false;
        settings.OmitXmlDeclaration = false;
        foreach (BaseSaverScript baseSaver in loader.playerBases) {
            using(StringWriter textWriter = new StringWriter()) {
                using(XmlWriter xmlWriter = XmlWriter.Create(textWriter, settings)) {
                    serialize.Serialize(xmlWriter, baseSaver);
                }
                gameScript.rpcScript.changePlayerBase(textWriter.ToString());
            }
        }

        foreach (ShipSaverScript shipSaver in loader.ships) {
            using(StringWriter textWriter = new StringWriter()) {
                using(XmlWriter xmlWriter = XmlWriter.Create(textWriter, settings)) {
                    serialize.Serialize(xmlWriter, shipSaver);
                }
                gameScript.rpcScript.CreateShip(textWriter.ToString());
            }
        }
    }
Example #17
0
 public void Restore(GameScript gameScript)
 {
     XmlSerializer serialize = new XmlSerializer(typeof(CellSaverScript));
     XmlWriterSettings settings = new XmlWriterSettings();
     settings.Encoding = new UnicodeEncoding(false, false);
     settings.Indent = false;
     settings.OmitXmlDeclaration = false;
     //We assume that gridScript has already been instantiated to the correct size
     for (int x = 0; x < grid.Count; x++) {
         for (int y = 0; y < grid[x].Count; y++) {
             using(StringWriter textWriter = new StringWriter()) {
                 using(XmlWriter xmlWriter = XmlWriter.Create(textWriter, settings)) {
                     serialize.Serialize(xmlWriter, grid[x][y]);
                 }
                 gameScript.rpcScript.SetGridCell(textWriter.ToString());
             }
         }
     }
 }
Example #18
0
    public GameSaverScript(GameScript gameScript)
    {
        grid = new GridSaverScript (gameScript.gridScript);
        ships = new List<ShipSaverScript> ();
        playerBases = new List<BaseSaverScript> ();
        foreach (ShipScript ship in gameScript.ships) {
            ships.Add (new ShipSaverScript(ship));
        }
        myname = gameScript.myname;
        opponentname = gameScript.opponentname;
        turn = gameScript.turn;
        curGameState = gameScript.curGameState;
        myPlayerType = gameScript.myPlayerType;
        winner = gameScript.winner;

        foreach (BaseScript baseScript in gameScript.bases) {
            playerBases.Add(new BaseSaverScript(baseScript));
        }
    }
Example #19
0
 public static bool Prefix(GameScript __instance)
 {
     if (!GadgetNetwork.MatrixReady && GadgetNetwork.GetTimeSinceConnect() < GadgetNetwork.MatrixTimeout)
     {
         if (InstanceTracker.GameScript.gameObject.GetComponent <RPCHooks>() == null)
         {
             InstanceTracker.GameScript.gameObject.AddComponent <RPCHooks>();
         }
         __instance.StartCoroutine(WaitAndTryAgain(__instance));
         return(false);
     }
     else
     {
         if (GadgetNetwork.GetTimeSinceConnect() > GadgetNetwork.MatrixTimeout && Gadgets.ListAllGadgetInfos().Any(x => x.Attribute.RequiredOnClients))
         {
             Network.Disconnect();
             return(false);
         }
         return(true);
     }
 }
Example #20
0
 public static bool Prefix(GameScript __instance)
 {
     instance = __instance;
     if (UnityEngine.Random.Range(0, 10) == 0)
     {
         int num = UnityEngine.Random.Range(0, 3);
         if (num == 0)
         {
             instance.StartCoroutine(queuedEvent = (IEnumerator)typeof(GameScript).GetMethod("SpacePirates", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(instance, new object[] { }));
         }
         else if (num == 1)
         {
             instance.StartCoroutine(queuedEvent = (IEnumerator)typeof(GameScript).GetMethod("GlitterBug", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(instance, new object[] { }));
         }
         else if (num == 2)
         {
             instance.StartCoroutine(queuedEvent = (IEnumerator)typeof(GameScript).GetMethod("Meteors", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(instance, new object[] { }));
         }
     }
     return(false);
 }
        public static void Postfix(GameScript __instance, int[] ___combatChips, int[] ___CHIPSTAT)
        {
            for (int i = 0; i < 6; i++)
            {
                int chipID = ___combatChips[i];
                if (ChipRegistry.Singleton.HasEntry(chipID))
                {
                    switch (chipID)
                    {
                    case 2:
                    case 3:
                    case 4:
                    case 5:
                    case 6:
                    case 7:
                        ___CHIPSTAT[chipID - 2] -= 3;
                        break;

                    case 52:
                    case 53:
                    case 54:
                    case 55:
                    case 56:
                    case 57:
                        ___CHIPSTAT[chipID - 52] -= 7;
                        break;

                    case 102:
                    case 103:
                    case 104:
                    case 105:
                    case 106:
                    case 107:
                        ___CHIPSTAT[chipID - 102] -= 15;
                        break;
                    }
                    ChipRegistry.Singleton.GetEntry(chipID).Stats.AddTo(___CHIPSTAT);
                }
            }
        }
Example #22
0
        public static bool Prefix(bool isLocked)
        {
            var gameScript = GameScript.Get();

            if (GameMode.Get().CompareWithCurrentMode(gameMode.UI) ||
                gameScript != null && gameScript.CurrentSceneType == SceneType.Menu ||
                gameScript.CurrentSceneType == SceneType.Showroom ||
                gameScript.CurrentSceneType == SceneType.Auction)
            {
                Screen.lockCursor = false;
                if (isLocked)
                {
                    Cursor.visible = false;
                    return(false);
                }

                Cursor.lockState = 0;
                return(false);
            }

            return(true);
        }
 public static bool Prefix(GameScript __instance)
 {
     if (!GadgetNetwork.MatrixReady && GadgetNetwork.GetTimeSinceConnect() < GadgetNetwork.MatrixTimeout)
     {
         if (InstanceTracker.GameScript.gameObject.GetComponent <RPCHooks>() == null)
         {
             InstanceTracker.GameScript.gameObject.AddComponent <RPCHooks>();
         }
         __instance.StartCoroutine(WaitAndTryAgain(__instance));
         return(false);
     }
     else
     {
         if (GadgetNetwork.GetTimeSinceConnect() > GadgetNetwork.MatrixTimeout && Gadgets.ListAllGadgetInfos().Any(x => x.Attribute.RequiredOnClients))
         {
             GadgetCore.CoreLogger.LogWarning("Disconnecting from server due to timout! You can try raising NetworkTimeout in the config.");
             Network.Disconnect();
             return(false);
         }
         return(true);
     }
 }
Example #24
0
    // Called when the script instance is being loaded.
    private void Awake()
    {
        //Get animator component
        anim = this.GetComponent <Animator>();
        anim.SetFloat("Speed", 0.0f);

        // Instantiate StateMachine.
        stateMachine = new StateMachine <PlayerScript>(this);

        // Get Terrain GameObject.
        GameObject gameObject = GameObject.Find("Terrain");

        // Error checking
        if (gameObject == null)
        {
            Debug.LogError("PlayerScript.cs: Game Object \"Terrain\" not found.");
        }
        else
        {
            // Get the GameScript component attached to the GameObject.
            gameScript = gameObject.GetComponent <GameScript>();

            if (gameScript == null)
            {
                Debug.LogError("PlayerScript.cs: GameScript component not found.");
            }
        }

        gameObject = GameObject.Find("GroundCheck");
        if (gameObject == null)
        {
            Debug.LogError("PlayerScript.cs: Game object \"GroundCheck\" not found.");
        }
        else
        {
            groundChk = gameObject;
        }
    }
 public static bool Prefix(GameScript __instance, ref Item[] ___craft, ref int ___craftType, int a, ref bool __result)
 {
     if (MenuRegistry.Singleton[___craftType] is CraftMenuInfo)
     {
         __result = !Input.GetMouseButtonDown(1);
         return(false);
     }
     if (___craftType == 3)
     {
         __result = __instance.CanPlaceCraft2(a);
         return(false);
     }
     if (ItemRegistry.Singleton.HasEntry(a))
     {
         ItemInfo item = ItemRegistry.Singleton.GetEntry(a);
         __result = true;
         for (int i = 0; i < 3; i++)
         {
             if (___craft[i].id == a)
             {
                 __result = false;
                 __instance.Error(4);
                 break;
             }
             if (___craft[i].id > 0)
             {
                 if ((ItemRegistry.Singleton.HasEntry(___craft[i].id) ? (int)(ItemRegistry.Singleton.GetEntry(a).Type & ItemType.TIER_MASK) >> 8 : ___craft[i].id % 10) != (int)(item.Type & ItemType.TIER_MASK) >> 8)
                 {
                     __result = false;
                     __instance.Error(5);
                     break;
                 }
             }
         }
         return(false);
     }
     return(true);
 }
Example #26
0
 public static bool Prefix(GameScript __instance, ref Item[] ___craft, ref int ___craftType, int a, ref bool __result)
 {
     if (MenuRegistry.Singleton[___craftType] is CraftMenuInfo && Input.GetMouseButtonDown(1))
     {
         __result = false;
         return(false);
     }
     if (___craftType == 3)
     {
         __result = (bool)typeof(GameScript).GetMethod("CanPlaceCraft2", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { a });
         return(false);
     }
     if (ItemRegistry.Singleton.HasEntry(a))
     {
         ItemInfo item = ItemRegistry.Singleton.GetEntry(a);
         __result = true;
         for (int i = 0; i < 3; i++)
         {
             if (___craft[i].id == a)
             {
                 __result = false;
                 __instance.Error(4);
                 break;
             }
             if (___craft[i].id > 0)
             {
                 if ((ItemRegistry.Singleton.HasEntry(___craft[i].id) ? (int)(ItemRegistry.Singleton.GetEntry(a).Type & ItemType.TIER_MASK) >> 8 : ___craft[i].id % 10) != (int)(item.Type & ItemType.TIER_MASK) >> 8)
                 {
                     __result = false;
                     __instance.Error(5);
                     break;
                 }
             }
         }
         return(false);
     }
     return(true);
 }
Example #27
0
 public static void Postfix(GameScript __instance)
 {
     foreach (MenuInfo menu in MenuRegistry.Singleton)
     {
         if (menu is CraftMenuInfo craftMenu)
         {
             craftMenu.unlockedRecipes = new HashSet <int>(PlayerPrefs.GetString("craftMenu" + craftMenu.ID + "unlocks")?.Split(',').Select(x => int.TryParse(x, out int val) ? (int?)val : null).Where(x => x.HasValue).Select(x => x.Value)) ?? new HashSet <int>();
         }
     }
     foreach (PlanetInfo planet in PlanetRegistry.Singleton)
     {
         planet.Relics = PreviewLabs.PlayerPrefs.GetInt("planetRelics" + planet.ID);
         if (planet.Relics > 99)
         {
             planet.Relics     = 99;
             planet.PortalUses = -1;
         }
         else
         {
             planet.PortalUses = PreviewLabs.PlayerPrefs.GetInt("portalUses" + planet.ID);
         }
     }
 }
Example #28
0
        public static bool Prefix(GameScript __instance, int slot, ref Item[] ___inventory, bool ___exitingcombatmode, ref bool ___usingItem)
        {
            ItemInfo item = ItemRegistry.GetSingleton().GetEntry(___inventory[slot].id);

            if (item != null && !GameScript.dead && !___exitingcombatmode && !___usingItem)
            {
                if ((item.Type & ItemType.USABLE) == ItemType.USABLE)
                {
                    ___usingItem = item.InvokeOnUse(slot);
                    if (!VanillaItemInfo.Using)
                    {
                        __instance.StartCoroutine(UseItemFinal(__instance, slot, item, ___inventory, ___usingItem));
                    }
                    VanillaItemInfo.Using = false;
                }
                else if ((item.Type & ItemType.EQUIPABLE) != ItemType.EQUIPABLE)
                {
                    __instance.StartCoroutine(UseItemFinal(__instance, slot, item, ___inventory, ___usingItem));
                }
                return(false);
            }
            return(true);
        }
Example #29
0
    private void Start()
    {
        // Load up which ship to use
        Load();

        // Ship is alive
        alive = true;

        // Starting invincible timer as player is invincible for 2 seconds to start
        invincibleTimer = Time.time + 2.0f;

        // Find the GameScript
        gameScript = FindObjectOfType <GameScript>();

        // Set up the health text
        gameScript.healthText(health);

        // Set up renderer
        renderer = GetComponent <Renderer>();

        // Set the laser speed
        laserScript.setLaserSpeed(shotSpeed);
    }
Example #30
0
 void Start()
 {
     RequestInterstitial();
     game = GameObject.Find("MOVABLE").GetComponent <GameScript>();
     ppImg.GetComponent <Image>().sprite = GameObject.Find(MainMenu.ArraysDataName).GetComponent <ArraysData>().ppList[PlayerPrefs.GetInt("pp", 2)];
     tot_kills = PlayerPrefs.GetInt("total_kill", 0);
     winns     = PlayerPrefs.GetInt("total_wins", 0);
     money     = PlayerPrefs.GetInt("money", 0);
     rank      = PlayerPrefs.GetInt("rank", 4);
     newWin    = PlayerPrefs.GetInt("new_win", 0);
     kills     = PlayerPrefs.GetInt("new_kills", 0);
     name      = PlayerPrefs.GetString("name", LanguageSystem.GET_NAME());
     winSerie  = PlayerPrefs.GetInt("winSerie", 0);
     loseSerie = PlayerPrefs.GetInt("loseSerie", 0);
     a         = nameLabel.GetComponent <UnityEngine.UI.Text>();
     b         = killsLabel.GetComponent <UnityEngine.UI.Text>();
     c         = winsLabel.GetComponent <UnityEngine.UI.Text>();
     d         = moneyLabel.GetComponent <UnityEngine.UI.Text>();
     e         = rankImg.GetComponent <Image>();
     saveStatus();
     writeStatus();
     show();
 }
Example #31
0
        public static bool Prefix(GameScript __instance, int slot, ref Item[] ___inventory, ref Item ___holdingItem, ref bool ___emblemAgain, ref int ___slotID)
        {
            bool hasEmblemRecipe = GadgetCoreAPI.emblemForgeRecipes.ContainsKey(___inventory[___slotID].id);
            int  lootPerEmblem   = hasEmblemRecipe ? GadgetCoreAPI.emblemForgeRecipes[___inventory[___slotID].id].Item2 : 10;

            if (___inventory[___slotID].q >= lootPerEmblem && (hasEmblemRecipe || ___inventory[___slotID].id <= 40))
            {
                __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/emblem"), Menuu.soundLevel / 10f);
                int emblemsToCraft = ___inventory[slot].q / lootPerEmblem;
                ___inventory[slot].q -= emblemsToCraft * 10;
                __instance.InvokeMethod("EmblemForging");
                ___emblemAgain = true;
                ___holdingItem = new Item(hasEmblemRecipe ? GadgetCoreAPI.emblemForgeRecipes[___inventory[___slotID].id].Item1 : __instance.InvokeMethod <int>("GetEmblemID", ___inventory[slot].id), emblemsToCraft, 0, 0, 0, new int[3], new int[3]);
                __instance.InvokeMethod("RefreshSlot", slot);
                __instance.InvokeMethod("RefreshHoldingSlot");
            }
            else
            {
                __instance.InvokeMethod("EmblemForging");
                ___emblemAgain = false;
            }
            return(false);
        }
Example #32
0
    public void Sacrifice()
    {
        GameScript gs = (GameScript)this.GetParent();

        if (this.Value > 100)
        {
            float purpleMod = ((this.Value - 100)) / 2400f;
            gs.PurpleChance = Mathf.Min(1, purpleMod + gs.PurpleChance);
            if (this.Value > 250)
            {
                float redMod = (this.Value - 250) / 9750f;
                gs.RedChance = Mathf.Min(1, redMod + gs.RedChance);
            }

            gs.RedoLuckText();
        }

        gs.voidParticles.Position = this.Position;
        gs.voidEmissionTime       = 1;
        gs.voidParticles.Emitting = true;
        gs.Sounds[SoundName.ChestSacrifice].Play();
        this.QueueFree();
    }
Example #33
0
        public static bool Prefix(GameScript __instance, int slot, ref Item ___holdingItem, ref Item[] ___inventory)
        {
            ItemInfo itemInfo        = ItemRegistry.Singleton.GetEntry(___holdingItem.id);
            ItemType holdingItemType = itemInfo != null ? (itemInfo.Type & (ItemType.EQUIP_MASK | ItemType.TYPE_MASK)) : ItemRegistry.GetDefaultTypeByID(___holdingItem.id);

            if ((holdingItemType & ItemType.NONSTACKING) == ItemType.NONSTACKING)
            {
                __instance.SelectItem(slot);
                return(false);
            }
            __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK2"), Menuu.soundLevel / 10f);
            if (___inventory[slot].q > 1)
            {
                int q = ___inventory[slot].q;
                ___inventory[slot].q /= 2;
                int num = q - ___inventory[slot].q;
                ___holdingItem   = GadgetCoreAPI.CopyItem(___inventory[slot]);
                ___holdingItem.q = num;
                __instance.RefreshSlot(slot);
                __instance.RefreshHoldingSlot();
            }
            return(false);
        }
Example #34
0
    // Use this for initialization
    void Start()
    {
        trans            = GetComponent <Transform>();
        anim             = transform.GetChild(0).GetComponent <Animator>();
        gameController   = GameObject.Find("GameController").GetComponent <GameScript>();
        buildingSpawner  = GameObject.Find("BuildingSpawner");
        spawnScript      = buildingSpawner.GetComponent <BuildingSpawner> ();
        frenzyController = GameObject.Find("FrenzyController").GetComponent <FrenzyMode>();
        b_img            = GameObject.Find("BlackFade").GetComponent <Image>();
        rb           = GetComponent <Rigidbody2D>();
        start        = transform.position;
        speed        = 0;
        runTime      = 0;
        jumpCount    = 0;
        jumping      = false;
        rolling      = false;
        grounded     = true;
        dead         = false;
        hitCount     = 0;
        lastPosition = this.transform.position;

        anim.SetFloat("xSpeed", speed);
    }
Example #35
0
    public void clickStack()
    {
        GameScript gameScript = FindObjectOfType <Camera>().GetComponent <GameScript>();

        // You can only interact with it if there's a card selected
        if (gameScript.getCardSelected() != null)
        {
            if (gameScript.getCardSelected().getSuit() == stackSuit)
            {
                if (stack.Count == 0 && gameScript.getCardSelected().getNumber() == 1)
                {
                    addToStack();
                }
                else if (stack.Count > 0)
                {
                    if (gameScript.getCardSelected().getNumber() == stack[stack.Count - 1].getNumber() + 1)
                    {
                        addToStack();
                    }
                }
            }
        }
    }
        public static bool Prefix(GameScript __instance, int slot, ref Item[] ___inventory, ref Item ___holdingItem, ref bool ___prismAgain, ref int ___slotID)
        {
            bool hasPrismRecipe = GadgetCoreAPI.prismForgeRecipes.ContainsKey(___inventory[___slotID].id);
            int  lootPerPrism   = hasPrismRecipe ? GadgetCoreAPI.prismForgeRecipes[___inventory[___slotID].id].Item2 : 10;

            if (___inventory[___slotID].q >= lootPerPrism && (hasPrismRecipe || (___inventory[___slotID].id >= 86 && ___inventory[___slotID].id <= 88)))
            {
                __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/glitter4"), Menuu.soundLevel / 10f);
                int prismsToCraft = ___inventory[slot].q / lootPerPrism;
                ___inventory[slot].q -= prismsToCraft * 10;
                __instance.InvokeMethod("Prismer");
                ___prismAgain  = false;
                ___holdingItem = new Item(hasPrismRecipe ? GadgetCoreAPI.prismForgeRecipes[___inventory[___slotID].id].Item1 : ___inventory[slot].id + 3, prismsToCraft, 0, 0, 0, new int[3], new int[3]);
                __instance.InvokeMethod("RefreshSlot", slot);
                __instance.InvokeMethod("RefreshHoldingSlot");
            }
            else
            {
                __instance.InvokeMethod("Prismer");
                ___prismAgain = false;
            }
            return(false);
        }
Example #37
0
        public static void Postfix(GameScript __instance, int i, ref Item[] ___modSlot)
        {
            AnimIcon animIcon = (AnimIcon)__instance.modIconBack[i].GetComponent("AnimIcon");

            if ((ItemRegistry.GetTypeByID(___modSlot[i].id) & ItemType.LEVELING) != ItemType.LEVELING)
            {
                __instance.modIconBack[i].SetActive(false);
                animIcon.anim = 0;
            }
            else
            {
                __instance.modIconBack[i].GetComponent <Renderer>().material = (Material)Resources.Load("iBack" + ___modSlot[i].tier);
                if (___modSlot[i].tier == 3)
                {
                    animIcon.anim = 1;
                }
                else
                {
                    animIcon.anim = 0;
                }
                __instance.modIconBack[i].SetActive(true);
            }
        }
 public static bool Prefix(GameScript __instance, Item[] ___craft, ref bool ___canCraft, ref int ___craftType)
 {
     if (MenuRegistry.Singleton.GetEntry(___craftType) is CraftMenuInfo craftMenu)
     {
         bool validated = false;
         for (int i = craftMenu.CraftValidators.Count - 1; i >= 0; i--)
         {
             if (craftMenu.CraftValidators[i](___craft))
             {
                 validated = true;
                 craftMenu.activePerformer = i;
                 craftMenu.craftResult     = ___craft.Select(x => GadgetCoreAPI.CopyItem(x)).ToArray();
                 craftMenu.CraftPerformers[i](craftMenu.craftResult);
                 ___canCraft = true;
                 __instance.buttonCraft.SendMessage("CanCraft", ___craftType, SendMessageOptions.DontRequireReceiver);
                 if (___craft[___craft.Length - 1].q == 0 && craftMenu.IsRecipeUnlocked(craftMenu.craftResult[craftMenu.craftResult.Length - 1].id))
                 {
                     __instance.previewObj.GetComponent <Renderer>().material = (Material)Resources.Load("i/i" + craftMenu.craftResult[craftMenu.craftResult.Length - 1].id);
                     __instance.previewObj.SetActive(true);
                 }
                 else
                 {
                     __instance.previewObj.SetActive(false);
                 }
                 break;
             }
         }
         if (!validated)
         {
             __instance.previewObj.SetActive(false);
             ___canCraft = false;
             __instance.buttonCraft.SendMessage("CantCraft", ___craftType, SendMessageOptions.DontRequireReceiver);
         }
         return(false);
     }
     return(true);
 }
Example #39
0
        private static void Extract(Options.ExtractOptions options)
        {
            GameScript script = ScriptManager.Scripts.FirstOrDefault(x => x.Name == options.Script);

            if (script == null)
            {
                Console.WriteLine($"Script '{options.Script}' not found.");
                Console.WriteLine();
                ListScripts(null);
                return;
            }

            if (!System.IO.Directory.Exists(options.GameDir))
            {
                Console.WriteLine($"Invalid game path: {options.GameDir}");
                return;
            }

            if (System.IO.Directory.Exists(options.Output))
            {
                Console.Write($"Output directory already exists. Overwrite (y/N)? ");
                string overwrite = Console.ReadLine();

                if (!string.Equals(overwrite, "Y", StringComparison.InvariantCultureIgnoreCase))
                {
                    Console.WriteLine("Cancelled by user.");
                    return;
                }

                System.IO.Directory.Delete(options.Output, true);
            }

            System.IO.Directory.CreateDirectory(options.Output);

            Console.WriteLine("Extracting game assets...");
            script.ExtractAssets(options.GameDir, options.Output);
        }
Example #40
0
    public void Start()
    {
        Joystick joy = (Joystick)GameObject.FindObjectOfType(typeof(Joystick));

        if (joy)
        {
            Destroy(joy.gameObject);
        }
        init();
        m_invertedX = PlayerPrefs.GetInt("GolfXAxis", 0);

        //save the default position and rotation so that we can set it back if we get a "fallout".
        m_deafultPos = transform.position;
        m_deafultRot = transform.rotation;

        m_initalLinearDrag  = GetComponent <Rigidbody>().drag;
        m_initalAngularDrag = GetComponent <Rigidbody>().angularDrag;
        //set the inital mode
        //	m_ballMode = initalMode;
        //get the game script
        m_gameScript = (GameScript)GameObject.FindObjectOfType(typeof(GameScript));
        //Constants.getGameScript();

        //find the trailNode -- this is an empty node but is useful for scaling the object
        m_trailNode = transform.Find("TrailNode");

        //get the trail renderer.
        m_trail = m_trailNode.transform.Find("Trail");
        enableTrail(false);



        transform.position = m_deafultPos;
        //aim our ball at the hole
        lookAtHole();
        //transform.rotation *= Quaternion.AngleAxis(180f,Vector3.up);
    }
Example #41
0
    // Start is called before the first frame update
    void Start()
    {
        game        = GameObject.Find("MOVABLE").GetComponent <GameScript>();
        createdMask = new GameObject("Mask_" + gameObject.name);


        createdMask = Instantiate(gameObject);
        createdMask.transform.SetParent(transform.parent.gameObject.transform, false);
        Destroy(createdMask.GetComponent <Button>());
        Destroy(createdMask.GetComponent <AudioSource>());
        Destroy(createdMask.GetComponent <buttonDelay>());
        Destroy(createdMask.GetComponent <ZoomButtonHandler>());
        foreach (Transform child in createdMask.transform)
        {
            Destroy(child.gameObject);
        }

        createdMask.transform.parent = transform;

        Color color = gameObject.GetComponent <Image>().color;

        createdMask.GetComponent <Image>().color = new Color(color.r, color.g, color.b, alpha);
        gameObject.GetComponent <Image>().color  = new Color(color.r, color.g, color.b, color.a - alpha / 2);
    }
    void Start()
    {
        Instance = this;

        rewardPoints = 0;

        thanksTexts = new string[] { "Well done!", "Great!", "Good job!", "WOW!", "Eagle Eye!", "Coin Hunter!", "Impressive!", "What!", "How!" };
        Camera.GetComponent <Animator> ().Play("CameraStart", -1, 0f);
        menuUi.GetComponent <Animator> ().Play("MenuOn", -1, 0f);
        subtitlesOn = true;
        StartCoroutine(WaitForOpenSubtitles());

        PlayGamesScript.Instance.LoadData();

        scoreUiscoreInt       = CloudVariables.ImportantValues [1];
        scoreUibestscore.text = "Best Score: " + CloudVariables.ImportantValues [1].ToString();

        if (CloudVariables.ImportantValues [0] == 1)
        {
            AudioListener.volume = 1.0f;
            soundoffmenu.GetComponent <Text> ().enabled = false;
            soundonmenu.GetComponent <Text> ().enabled  = true;
            soundoff.GetComponent <Text> ().enabled     = false;
            soundon.GetComponent <Text> ().enabled      = true;
        }
        else if (CloudVariables.ImportantValues [0] == 0)
        {
            AudioListener.volume = 0.0f;
            soundoffmenu.GetComponent <Text> ().enabled = true;
            soundonmenu.GetComponent <Text> ().enabled  = false;
            soundoff.GetComponent <Text> ().enabled     = true;
            soundon.GetComponent <Text> ().enabled      = false;
        }

        score.text = scoreInt.ToString();
    }
        public static void Postfix(GameScript __instance, int i, ref Item[] ___storage, ref int ___curStoragePage)
        {
            int      num      = i + (___curStoragePage * 30);
            AnimIcon animIcon = (AnimIcon)__instance.storageIconBack[i].GetComponent("AnimIcon");

            if ((ItemRegistry.GetTypeByID(___storage[num].id) & ItemType.LEVELING) != ItemType.LEVELING)
            {
                __instance.storageIconBack[i].SetActive(false);
                animIcon.anim = 0;
            }
            else
            {
                __instance.storageIconBack[i].GetComponent <Renderer>().material = (Material)Resources.Load("iBack" + ___storage[num].tier);
                if (___storage[num].tier == 3)
                {
                    animIcon.anim = 1;
                }
                else
                {
                    animIcon.anim = 0;
                }
                __instance.storageIconBack[i].SetActive(true);
            }
        }
Example #44
0
    // Use this for initialization
    void Start()
    {
        //Get the game manager script
        GameObject g = GameObject.Find ("GameManager");
        globalObj = g.GetComponent< GameScript >();

        board = new int[globalObj.boardSize + 2][];

        for(int i=0; i < globalObj.boardSize + 2; ++i){
            board[i] = new int[globalObj.boardSize + 2];
            for(int j=0; j < globalObj.boardSize + 2; ++j){
                board[i][j] = 3;
            }
        }

        board [0] [0] = 2;
    }
 void Start()
 {
     tr = GetComponent<RectTransform>();
     startingPos = tr.position;
     gameScript = GameObject.Find("Main Camera").GetComponent<GameScript>();
 }
Example #46
0
//	private string m_state;
	public void Start()
	{
		m_audioSource = gameObject.GetComponent<AudioSource>();
		#if PHOTON_MULTIPLAYER
		if(PhotonNetwork.offlineMode==false)
		{
			startButtonGO.SetActive(false);
		}else{
			total2GT.gameObject.SetActive(false);
			totalBackground2.SetActive (false);

			waitGO.SetActive(false);
		}
#else
		DestroyObject(GameObject.Find ("D_Multiplayer"));
		total2GT.gameObject.SetActive(false);
		totalBackground2.SetActive (false);
		waitGO.SetActive(false);

#endif

		//get out gamescript component
		GameObject go = GameObject.FindWithTag("Game");
		if(go)
		{
			m_gameScript = go.GetComponent<GameScript>();
		}

	}
Example #47
0
        public static bool Prefix(GameScript __instance, int slot, ref Item ___holdingItem, ref Item[] ___inventory, bool ___emblemAgain)
        {
            ItemInfo itemInfo        = ItemRegistry.Singleton.GetEntry(___holdingItem.id);
            ItemType holdingItemType = itemInfo != null ? (itemInfo.Type & (ItemType.EQUIP_MASK | ItemType.TYPE_MASK)) : ItemRegistry.GetDefaultTypeByID(___holdingItem.id);

            if ((holdingItemType & ItemType.NONSTACKING) == ItemType.NONSTACKING)
            {
                SwapItem.Invoke(__instance, new object[] { slot });
                return(false);
            }
            if ((slot == 36 && (holdingItemType & ItemType.EQUIP_MASK) != ItemType.WEAPON) || (slot == 37 && ((holdingItemType & ItemType.EQUIP_MASK) != ItemType.OFFHAND)) || (slot == 38 && ((holdingItemType & ItemType.EQUIP_MASK) != ItemType.HELMET)) || (slot == 39 && ((holdingItemType & ItemType.EQUIP_MASK) != ItemType.ARMOR)) || ((slot == 40 || slot == 41) && ((holdingItemType & ItemType.EQUIP_MASK) != ItemType.RING)) || (slot > 41 && ((holdingItemType & ItemType.EQUIP_MASK) != ItemType.DROID)))
            {
                MonoBehaviour.print("CANNOT PUT THAT THERE!");
            }
            else
            {
                MonoBehaviour.print("PLACING ONE ITEM");
                if (___emblemAgain)
                {
                    EmblemForging.Invoke(__instance, new object[] { });
                }
                bool newItem = false;
                if (___inventory[slot].id == ___holdingItem.id)
                {
                    ___inventory[slot].q++;
                }
                else
                {
                    newItem              = true;
                    ___inventory[slot]   = GadgetCoreAPI.CopyItem(___holdingItem);
                    ___inventory[slot].q = 1;
                }
                ___holdingItem.q--;
                MonoBehaviour.print(string.Concat(new object[]
                {
                    "holding Item ",
                    ___holdingItem.id,
                    " x",
                    ___holdingItem.q
                }));
                RefreshSlot.Invoke(__instance, new object[] { slot });
                RefreshHoldingSlot.Invoke(__instance, new object[] { });
                if (slot > 35)
                {
                    if (slot > 41)
                    {
                        __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/placeD"), Menuu.soundLevel / 10f);
                    }
                    else
                    {
                        __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/bling"), Menuu.soundLevel / 10f);
                    }
                    if (newItem)
                    {
                        if (slot == 36)
                        {
                            GameScript.equippedIDs[0] = ___inventory[slot].id;
                        }
                        else if (slot == 37)
                        {
                            GameScript.equippedIDs[1] = ___inventory[slot].id;
                        }
                        else if (slot == 38)
                        {
                            GameScript.equippedIDs[2] = ___inventory[slot].id;
                        }
                        else if (slot == 39)
                        {
                            GameScript.equippedIDs[3] = ___inventory[slot].id;
                        }
                        int[] gearStats = GadgetCoreAPI.GetGearStats(___inventory[slot]).GetStatArray();
                        for (int i = 0; i < 6; i++)
                        {
                            if (gearStats[i] > 0)
                            {
                                GameScript.GEARSTAT[i] += gearStats[i];
                                __instance.txtPlayerStat[i].GetComponent <Animation>().Play();
                            }
                        }
                        GadgetCoreAPI.equippedGearStats[slot - 36] = gearStats;
                        RefreshStats.Invoke(__instance, new object[] { });
                        Network.RemoveRPCs(MenuScript.playerAppearance.GetComponent <NetworkView>().viewID);
                        int[] convertedIDs = new int[]
                        {
                            GadgetNetwork.ConvertIDToHost(ItemRegistry.Singleton, GameScript.equippedIDs[0]),
                            GadgetNetwork.ConvertIDToHost(ItemRegistry.Singleton, GameScript.equippedIDs[1]),
                            GadgetNetwork.ConvertIDToHost(ItemRegistry.Singleton, GameScript.equippedIDs[2]),
                            GadgetNetwork.ConvertIDToHost(ItemRegistry.Singleton, GameScript.equippedIDs[3]),
                            GadgetNetwork.ConvertIDToHost(null /* RaceRegistry */, GameScript.equippedIDs[4]),
                            GameScript.equippedIDs[5],
                            GadgetNetwork.ConvertIDToHost(null /* UniformRegistry */, GameScript.equippedIDs[6]),
                            GadgetNetwork.ConvertIDToHost(null /* AugmentRegistry */, GameScript.equippedIDs[7])
                        };
                        MenuScript.playerAppearance.GetComponent <NetworkView>().RPC("UA", RPCMode.AllBuffered, new object[]
                        {
                            convertedIDs,
                            0,
                            GameScript.dead
                        });
                        RefreshMODS.Invoke(__instance, new object[] { });
                        __instance.UpdateHP();
                        __instance.UpdateEnergy();
                        __instance.UpdateMana();
                    }
                    if (itemInfo != null)
                    {
                        itemInfo.InvokeOnEquip(slot);
                    }
                }
                else
                {
                    __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK2"), Menuu.soundLevel / 10f);
                }
            }
            return(false);
        }
 void Start()
 {
     game = (GameScript)  GameObject.Find("GameScript").GetComponent(typeof(GameScript));
 }
Example #49
0
	public void SetManager(GameScript manager){
		m_sGame = manager;
	}
Example #50
0
 public static bool Prefix(GameScript __instance, ref bool ___shiftclicking, Item[] ___inventory, ref Item[] ___gatherStorage, int slot, int ___curStoragePage, ref IEnumerator __result)
 {
     itemInSlot = ___gatherStorage[slot];
     if (!___shiftclicking)
     {
         ItemInfo slotInfo     = ItemRegistry.Singleton.GetEntry(itemInSlot.id);
         ItemType slotItemType = slotInfo != null ? (slotInfo.Type & (ItemType.EQUIP_MASK | ItemType.TYPE_MASK)) : ItemRegistry.GetDefaultTypeByID(itemInSlot.id);
         int      num          = 0;
         if ((slotItemType & ItemType.NONSTACKING) == ItemType.STACKING)
         {
             bool flag1 = false, flag2 = false;
             for (int i = 0; i < 36; i++)
             {
                 if (GadgetCoreAPI.CanItemsStack(___inventory[i], itemInSlot) && ___inventory[i].q < 9999)
                 {
                     if (___inventory[i].q + ___gatherStorage[slot].q <= 9999)
                     {
                         flag1 = true;
                         num   = i;
                         break;
                     }
                     else
                     {
                         if (!flag2)
                         {
                             __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                         }
                         ___gatherStorage[slot].q -= 9999 - ___inventory[i].q;
                         ___inventory[i].q         = 9999;
                         __instance.RefreshSlot(i);
                         flag2 = true;
                     }
                 }
             }
             if (flag1)
             {
                 __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                 ___inventory[num].q   += ___gatherStorage[slot].q;
                 ___gatherStorage[slot] = new Item(0, 0, 0, 0, 0, new int[3], new int[3]);
                 __instance.RefreshSlot(num);
             }
             else
             {
                 for (int i = 0; i < 36; i++)
                 {
                     if (___inventory[i].id == 0)
                     {
                         if (!flag2)
                         {
                             __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                         }
                         ___inventory[i]        = ___gatherStorage[slot];
                         ___gatherStorage[slot] = new Item(0, 0, 0, 0, 0, new int[3], new int[3]);
                         __instance.RefreshSlot(i);
                         break;
                     }
                     else if (GadgetCoreAPI.CanItemsStack(___inventory[i], itemInSlot) && ___inventory[i].q < 9999)
                     {
                         if (___inventory[i].q + ___gatherStorage[slot].q <= 9999)
                         {
                             if (!flag2)
                             {
                                 __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                             }
                             ___inventory[i].q     += ___gatherStorage[slot].q;
                             ___gatherStorage[slot] = new Item(0, 0, 0, 0, 0, new int[3], new int[3]);
                             __instance.RefreshSlot(i);
                             break;
                         }
                         else
                         {
                             if (!flag2)
                             {
                                 __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                             }
                             ___gatherStorage[slot].q -= 9999 - ___inventory[i].q;
                             ___inventory[i].q         = 9999;
                             __instance.RefreshSlot(i);
                         }
                         flag2 = true;
                     }
                 }
             }
             __instance.RefreshSlotGather(slot);
             ___shiftclicking = false;
             __result         = FakeRoutine();
             return(false);
         }
         else
         {
             for (int i = 0; i < 36; i++)
             {
                 if (___inventory[i].id == 0)
                 {
                     __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                     ___inventory[i]        = ___gatherStorage[slot];
                     ___gatherStorage[slot] = new Item(0, 0, 0, 0, 0, new int[3], new int[3]);
                     __instance.RefreshSlot(i);
                     __instance.RefreshSlotGather(slot);
                     break;
                 }
             }
         }
     }
     return(true);
 }
Example #51
0
    void Start()
    {
        player = GameObject.FindWithTag( TAGS.PLAYER ).transform;
        gameScript = GameObject.FindWithTag( TAGS.WORLD ).GetComponent< GameScript >();

        rigidBody = GetComponent< Rigidbody >();
        state = BULLET_STATE.GOING;

        direction = Vector3.zero;

        type = ( BULLET_TYPE ) BULLET_COUNTER;
        groupID = GROUP_COUNTER;

        YFlipBlocked = false;

        flipped = Vector3.one;

        IsDead = false;

        if( ++BULLET_COUNTER >= ( int ) BULLET_TYPE.COUNT )
        {
            BULLET_COUNTER = 0;
            ++GROUP_COUNTER;
        }

        block_reverse_time = MAX_BLOCK_TIME;

        switch( type )
        {
            case BULLET_TYPE.RED:
            {
                trail.material =
                    ( Material ) Instantiate( Resources.Load( "BULLET_TRAIL_RED_MATERIAL" ) );
            } break;

            case BULLET_TYPE.PURPLE:
            {
                trail.material =
                    ( Material ) Instantiate( Resources.Load( "BULLET_TRAIL_PURPLE_MATERIAL" ) );
            } break;

            case BULLET_TYPE.YELLOW:
            {
                trail.material =
                    ( Material ) Instantiate( Resources.Load( "BULLET_TRAIL_YELLOW_MATERIAL" ) );
            } break;
        }
    }
Example #52
0
 // Use this for initialization
 void Start()
 {
     // Finds the game manager object
     load = GameObject.Find ("GameManager").GetComponent<GameScript>();
 }
Example #53
0
 public static bool Prefix(GameScript __instance, ref bool ___shiftclicking, Item[] ___inventory, ref Item[] ___storage, int slot, int ___curStoragePage, ref int ___droidCount, ref IEnumerator __result)
 {
     if (!___shiftclicking)
     {
         itemInSlot = ___inventory[slot];
         ItemInfo slotInfo     = ItemRegistry.Singleton.GetEntry(itemInSlot.id);
         ItemType slotItemType = slotInfo != null ? (slotInfo.Type & (ItemType.EQUIP_MASK | ItemType.TYPE_MASK)) : ItemRegistry.GetDefaultTypeByID(itemInSlot.id);
         int      num          = 0;
         int      num2         = ___curStoragePage * 30;
         int      num3         = num2 + 30;
         if ((slotItemType & ItemType.NONSTACKING) == ItemType.STACKING)
         {
             bool flag1 = false, flag2 = false;
             for (int i = num2; i < num3; i++)
             {
                 if (GadgetCoreAPI.CanItemsStack(___storage[i], itemInSlot) && ___storage[i].q < 9999)
                 {
                     if (___storage[i].q + ___inventory[slot].q <= 9999)
                     {
                         flag1 = true;
                         num   = i;
                     }
                     else
                     {
                         if (!flag2)
                         {
                             __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                         }
                         ___inventory[slot].q -= 9999 - ___storage[i].q;
                         ___storage[i].q       = 9999;
                         flag2 = true;
                     }
                     break;
                 }
             }
             if (flag1)
             {
                 __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                 ___storage[num].q += ___inventory[slot].q;
                 ___inventory[slot] = new Item(0, 0, 0, 0, 0, new int[3], new int[3]);
             }
             else
             {
                 for (int i = num2; i < num3; i++)
                 {
                     if (___storage[i].id == 0)
                     {
                         if (!flag2)
                         {
                             __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                         }
                         ___storage[i]      = ___inventory[slot];
                         ___inventory[slot] = new Item(0, 0, 0, 0, 0, new int[3], new int[3]);
                         break;
                     }
                     else if (GadgetCoreAPI.CanItemsStack(___storage[i], itemInSlot) && ___storage[i].q < 9999)
                     {
                         if (___storage[i].q + ___inventory[slot].q <= 9999)
                         {
                             if (!flag2)
                             {
                                 __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                             }
                             ___storage[i].q   += ___inventory[slot].q;
                             ___inventory[slot] = new Item(0, 0, 0, 0, 0, new int[3], new int[3]);
                             break;
                         }
                         else
                         {
                             if (!flag2)
                             {
                                 __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                             }
                             ___inventory[slot].q -= 9999 - ___storage[i].q;
                             ___storage[i].q       = 9999;
                         }
                         flag2 = true;
                     }
                 }
             }
             __instance.RefreshSlot(slot);
             __instance.StartCoroutine(__instance.RefreshStoragePage(___curStoragePage));
         }
         else
         {
             for (int i = num2; i < num3; i++)
             {
                 if (___storage[i].id == 0)
                 {
                     if (slot > 35)
                     {
                         if (slot == 36)
                         {
                             GameScript.equippedIDs[0] = 0;
                         }
                         else if (slot == 37)
                         {
                             GameScript.equippedIDs[1] = 0;
                         }
                         else if (slot == 38)
                         {
                             GameScript.equippedIDs[2] = 0;
                         }
                         else if (slot == 39)
                         {
                             GameScript.equippedIDs[3] = 0;
                         }
                         else if (slot == 40)
                         {
                             GameScript.equippedIDs[4] = 0;
                         }
                         else if (slot == 41)
                         {
                             GameScript.equippedIDs[5] = 0;
                         }
                         int[] stats = GadgetCoreAPI.equippedGearStats[slot - 36];
                         for (int s = 0; s < 6; s++)
                         {
                             if (stats[s] > 0)
                             {
                                 GameScript.GEARSTAT[s] -= stats[s];
                                 __instance.txtPlayerStat[s].GetComponent <Animation>().Play();
                             }
                         }
                         GadgetCoreAPI.equippedGearStats[slot - 36] = new int[] { 0, 0, 0, 0, 0, 0 };
                         __instance.RefreshStats();
                         Network.RemoveRPCs(MenuScript.playerAppearance.GetComponent <NetworkView>().viewID);
                         MenuScript.playerAppearance.GetComponent <NetworkView>().RPC("UA", RPCMode.AllBuffered, new object[]
                         {
                             GameScript.equippedIDs,
                             0,
                             GameScript.dead
                         });
                         __instance.UpdateHP();
                         __instance.UpdateEnergy();
                         __instance.UpdateMana();
                     }
                     __instance.GetComponent <AudioSource>().PlayOneShot((AudioClip)Resources.Load("Au/CLICK3"), Menuu.soundLevel / 10f);
                     ___storage[i]      = ___inventory[slot];
                     ___inventory[slot] = new Item(0, 0, 0, 0, 0, new int[3], new int[3]);
                     __instance.RefreshSlot(slot);
                     __instance.StartCoroutine(__instance.RefreshStoragePage(___curStoragePage));
                     if (slotItemType == ItemType.DROID && slot > 41)
                     {
                         ___droidCount--;
                         __instance.UpdateDroids();
                     }
                     if (slotInfo != null)
                     {
                         slotInfo.InvokeOnDequip(slot);
                     }
                     break;
                 }
             }
         }
         ___shiftclicking = false;
         __result         = FakeRoutine();
         return(false);
     }
     return(true);
 }
 // Use this for initialization
 void Start()
 {
     animator = GetComponent<Animator>();
     game = GameObject.Find("GAME");
     gameScript = game.GetComponent<GameScript>();
 }
Example #55
0
    void Awake()
    {
        singleton = this;
        reverseOptions = Random.value >= 0.5f;

        if(!Application.isWebPlayer){
            if(File.Exists(SaveGameFilename)){
                LoadGame();
            } else {
                SaveGame();
            }
        }
        //SetTutorialStatus(false);

        if(tutorialFinished) gameStep = GameStep.Question;
        Application.targetFrameRate = 60;
    }
Example #56
0
 void Start()
 {
     gameScript =
         GameObject.FindWithTag( TAGS.WORLD ).GetComponent< GameScript >();
 }
 public static bool Prefix(PlayerScript __instance, ref bool ___attacking, ref bool ___canAttack, ref GameScript ___gameScript, ref IEnumerator __result)
 {
     if (ItemRegistry.GetSingleton().HasEntry(GameScript.equippedIDs[0]) && !___attacking && ___canAttack && !___gameScript.combatSwitching && !PlayerScript.beaming && !VanillaItemInfo.Attacking)
     {
         ItemRegistry.GetSingleton().GetEntry(GameScript.equippedIDs[0]).InvokeOnAttack(__instance);
         __result = GadgetCoreAPI.EmptyEnumerator();
         return(false);
     }
     return(true);
 }
 void Awake()
 {
     gameScript = GameObject.Find("Game").GetComponent<GameScript>();
 }
 // Update is called once per frame
 void Update()
 {
     gameScript = GameObject.Find("GameScripts").GetComponent <GameScript>();
 }
    // Use this for initialization
    void Start()
    {
        //Rect position initializations
        game = GameObject.Find("GAME");
        gameScript = game.GetComponent<GameScript>();
        cameraMouseLookScript = Camera.main.GetComponent<MouseLook>();
        playerMouseLookScript = gameScript.Player.GetComponent<MouseLook>();
        menuContentButtonRect.x = Screen.width / 2f - 50f;
        menuContentButtonRect.y = Screen.height / 2f - 25f;

        fullHealthBarRect.x = Screen.width/2f - fullHealthBarRect.width/2f;
        fullHealthBarRect.y = Screen.height - 5f - fullHealthBarRect.height;

        widthRatioToFullHealth = fullHealthBarRect.width / 100;

        healthBarRect = fullHealthBarRect;

        itemRect.y = Screen.height - 5f - itemRect.height;

        itemXPositions = new float[itemCount];
        for(int i = 0; i < itemXPositions.Length; i++) {
            if(i == 0) {	//first is exception to logic
                itemXPositions[i] = Screen.width - 5f - itemRect.width;
            }
            else {
                itemXPositions[i] = itemXPositions[i - 1] - 10f - itemRect.width;
            }
        }
    }