Inheritance: MonoBehaviour
Example #1
0
    /// <summary>
    /// Make a place new IconScript for AbstractObject.
    /// If AbstractObject has his own coordinats != 1, the game will use them
    /// </summary>
    /// <param name="x"> coordinat of free space </param>
    /// <param name="y"> coordinat of free space </param>
    /// <param name="itm"> source </param>
    /// <returns> new IconScript object </returns>
    public static GameObject PlaceNewGameobject(float x, float y, AbstractObject itm)
    {
        MainScript ms = Camera.main.GetComponent <MainScript>();
        GameObject go = Instantiate(ms.m_iconPrefab);

        go.name = itm.m_name;
        IconScript isc = go.GetComponent <IconScript>();

        isc.m_ms = ms;
        if (isc != null)
        {
            isc.m_thisItem = itm;
        }

        isc._tmpPos.z = go.transform.position.z;
        //if coordinates does not set in excel, it will be random
        if (itm.m_defaultX == 1 && itm.m_defaultY == 1)
        {
            isc._tmpPos.x = x;
            isc._tmpPos.y = y;
        }
        else
        {
            isc._tmpPos.x = itm.m_defaultX;
            isc._tmpPos.y = itm.m_defaultY;
        }
        go.transform.position = isc._tmpPos;

        isc.m_thisItem.m_thisObject = isc;
        isc.m_thisItem.ChangeProductionType(
            isc.transform.Find("smallIcon").GetComponent <SpriteRenderer>(), isc);
        MainScript.m_sAllItems.Add(go);

        return(go);
    }
Example #2
0
    void Start()
    {
        ms = GameObject.Find("MainScript").GetComponent <MainScript>();
        mc = this.GetComponent <MeshCollider>();
        mf = this.GetComponent <MeshFilter>();

        myTag = transform.tag;
        if (destroyedBlocks == null)
        {
            destroyedBlocks = new bool[16];
            for (int i = 0; i < 16; i++)
            {
                destroyedBlocks[i] = true;
            }
        }
        if (oldDestroyedBlocks == null)
        {
            oldDestroyedBlocks = new bool[16];
            for (int i = 0; i < 16; i++)
            {
                oldDestroyedBlocks[i] = true;
            }
        }

        RefreshBricks();
    }
Example #3
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #4
0
    void Update()
    {
        MainScript mainScript = GameObject.Find("Main").GetComponent <MainScript>();

        if (mainScript.numberGamesBeforeAdd == 0)
        {
            const string RewardedZoneId = "adsInterlude";
            var          options        = new ShowOptions {
                resultCallback = HandleShowResult
            };
            Advertisement.Show(RewardedZoneId, options);

            mainScript.numberGamesBeforeAdd = Random.Range(5, 9);
        }
        if (Advertisement.isShowing)
        {
            source.Stop();
            Time.timeScale = 0;
        }
        else
        {
            Time.timeScale = 1;
            if (!source.isPlaying)
            {
                source.Play();
            }
        }
    }
Example #5
0
 // Use this for initialization
 void Start()
 {
     self = this;
     fon_card.SetActive(true);
     fon_tours.SetActive(true);
     fon_card.SetActive(false);
 }
Example #6
0
    void OnTriggerEnter2D(Collider2D otherCollider)
    {
        TriggerScript trigger = otherCollider.gameObject.GetComponent <TriggerScript> ();
        MainScript    main    = GameObject.Find("Scripts").GetComponent <MainScript> ();

        if ((int)trigger.location.y == 0 || main.board [(int)trigger.location.x, (int)trigger.location.y - 1] != 0)
        {
            main.board [(int)trigger.location.x, (int)trigger.location.y] = color;
            if (color == 1)
            {
                main.color = 2;
                Debug.Log(trigger.location.x + ", " + trigger.location.y + " = Red");
                if (main.Check())
                {
                    main.win = true;
                    Debug.Log("Red wins!");
                }
            }
            else if (color == 2)
            {
                main.color = 1;
                Debug.Log(trigger.location.x + ", " + trigger.location.y + " = Blue");
                if (main.Check())
                {
                    main.win = true;
                    Debug.Log("Blue wins!");
                }
            }
        }
    }
Example #7
0
 // Use this for initialization
 void Start()
 {
     i          = 0.5f;
     mainscript = GameObject.Find("MAIN").GetComponent <MainScript>();
     StartCoroutine(Spawn(i));
     StartCoroutine(Animat());
 }
Example #8
0
 private void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(0))
     {
         MainScript.UIMakeAMove(x, y);
     }
 }
    public void editsong()
    {
        json = File.ReadAllText(Application.persistentDataPath + "/songslist.json");    // perから読むにはreadalltextしかない、wwwは無理…散々悩んだ

        Debug.Log(json);

        JsonUtility.FromJsonOverwrite(json, ms);

        MainScript d1 = scriptbox.GetComponent <MainScript>();


        ms.songname[j] = (songname_t.text);   //曲名

        type_toggleswich d2 = type_toggle.GetComponent <type_toggleswich>();

        ms.type[j] = d2.type;

        Int32.TryParse(difficulty_t.text, out dd); //変換
        ms.difficulty[j] = (dd);                   //難易度
        Int32.TryParse(notes_t.text, out ll);      //変換
        ms.notes[j] = (ll);                        //ノーツ数
        json        = JsonUtility.ToJson(ms);
        Debug.Log(json);



        File.WriteAllText(Application.persistentDataPath + "/songslist.json", json);//結局これでよかった
    }
Example #10
0
 // Use this for initialization
 void Start()
 {
     script = GameObject.Find("manage").GetComponent <MainScript> ();
     heart2.SetActive(true);
     heart1.SetActive(true);
     heart.SetActive(true);
 }
Example #11
0
 // Start is called before the first frame update
 void Start()
 {
     //各種オブジェクトを取得
     mainSystem   = GameObject.Find("Main System").GetComponent <MainScript>();
     DBAdapter    = GameObject.Find("Database Adapter").GetComponent <TMSDatabaseAdapter>();
     calib_system = GameObject.Find("B-sen Calibration System").GetComponent <BsenCalibrationSystem>();
 }
Example #12
0
    public static void show()
    {
        GameObject obj = Resources.Load("Prefabs/UI/UIMain") as GameObject;

        s_gameObject = Instantiate(obj, GameObject.Find("LowCanvas").transform);
        s_script     = s_gameObject.GetComponent <MainScript>();
    }
Example #13
0
 public void StartCalibrationStage(MainScript _main)
 {
     transform.GetChild(0).gameObject.SetActive(true);
     main = _main;
     SetHeight();
     StartCoroutine(CheckForFinishedState());
 }
Example #14
0
 // Use this for initialization
 void Start()
 {
     Total_score=0;
     Soul_score=0;
     Kill_score=0;
     Time_score=0;
     ScriptCtrl = GameObject.Find("ALLScriptCtrl").GetComponent<MainScript>();
     Soul_score=ScriptCtrl.NumOfSoulGet*10;
     Kill_score=ScriptCtrl.NumOfMonsterKill*100;
     if(ScriptCtrl.passTime>=60000 && ScriptCtrl.passTime <180000)
     {
         Time_score=Mathf.FloorToInt(Mathf.Lerp(5000,3000,ScriptCtrl.passTime/180));
     }
     else if(ScriptCtrl.passTime>=180000 && ScriptCtrl.passTime<300000)
     {
         Time_score=Mathf.FloorToInt(Mathf.Lerp(3000,1000,(ScriptCtrl.passTime-180)/180));
     }
     else
     {
         Time_score=Mathf.FloorToInt(Mathf.Lerp(1000,0,(ScriptCtrl.passTime-360)/360));
     }
     Total_score=Soul_score+Kill_score+Time_score;
     Time_label.GetComponent<UILabel>().text=Time_score.ToString();
     Soul_label.GetComponent<UILabel>().text=Soul_score.ToString();
     Kill_label.GetComponent<UILabel>().text=Kill_score.ToString();
     Total_score_label.GetComponent<UILabel>().text=Total_score.ToString();
 }
    // ボタンが押された時の処理
    public void OnClick()
    {
        //Debug.Log("Text: LeftClick");

        // 白:左  赤:右
        string text = textFlag.text;

        if (text == "白")
        {
            // 別スクリプト参照
            GameObject g          = GameObject.Find("MainScript");
            MainScript mainScript = g.GetComponent <MainScript>();
            mainScript.Reset();

            // 時間リセット
            mainScript.ResetTimer();

            // スコア加算
            mainScript.AddScore();
        }
        else
        {
            // 別スクリプト参照
            GameObject g          = GameObject.Find("MainScript");
            MainScript mainScript = g.GetComponent <MainScript>();

            // ハイスコア記録
            mainScript.AddHighScore();

            // 不正解
            SceneManager.LoadScene("EndScene");
        }
    }
    public IEnumerator Start()
    {
        if (explosionPool == null)
        {
            Debug.LogError("You must populate 'explosionPool' with the corresponding object pool located in 'ObjectPools Container'", gameObject);
        }
        if (weaponPool == null)
        {
            Debug.LogError("You must populate 'weaponPool' with the corresponding object pool located in 'ObjectPools Container'", gameObject);
        }
        if (pointerInputTr == null)
        {
            Debug.LogError("You must populate 'pointerInputTr' with the corresponding gameObject", gameObject);
        }
        if (pointerInputScript == null)
        {
            Debug.LogError("You must populate 'pointerInputScript' with the corresponding script", gameObject);
        }

        // We cache components, this is usefull for performance optimisation !
        myTr        = transform;                                        // We will now use "myTr" instead of "transform"
        mySpriteRdr = myTr.GetComponent <SpriteRenderer>();             // Same as above, we will now use "mySpriteRdr"

        // Reference player's exhaust transform. 'GameObject.Find("PlayerExhaust")' will return the game object named 'Exhaust', which is a child of 'Player'
        myExhaustGo = GameObject.Find("PlayerExhaust");         // (cache component)
        myExhaustTr = myExhaustGo.transform;                    // (cache component)

        // Find MainScript
        cam        = Camera.main;
        mainScript = cam.GetComponent <MainScript>();

        camTr = cam.transform;                                                          // (cache component)

        myTr.localPosition = new Vector3(-1.0f, myTr.localPosition.y, myTr.localPosition.z);

        // Enable moves
        canMove = true;

        UpgradeSpeed();                  // Set initial speed
        StartCoroutine(UpgradeWeapon()); // Set initial weapon

        yield return(null);

        canShoot = true;

        // Find screen buttons container
        GameObject onScreenBts = ScreenButtonMove.transform.parent.gameObject;

        // If
        if (ScreenButtonsInputAllowed == true)
        {
            pointerInputAllowed = false;
            onScreenBts.SetActive(true);
        }

        else
        {
            onScreenBts.SetActive(false);
        }
    }
Example #17
0
 public int renge;   // досигаемость оружия бота
                     // Use this for initialization
 void Start()
 {
     H    = Screen.height;
     W    = Screen.width;
     cont = GameObject.Find("Controller");
     ms   = cont.GetComponent <MainScript>();
 }
 // Use this for initialization
 void Start()
 {
     gameEngine   = GameObject.Find("GameEngine");
     mainScript   = gameEngine.GetComponent("MainScript") as MainScript;
     loggerObject = GameObject.Find("Logger");
     logger       = loggerObject.GetComponent <LoggerScript>();
 }
Example #19
0
    protected override void NetworkStart()
    {
        base.NetworkStart();

        NetworkManager.Instance.Networker.onPingPong += OnPingPong;

        if (networkObject.IsOwner)
        {
            MainScript main = GameObject.FindObjectOfType <MainScript>();
            networkObject.SendRpc(PlayerBehavior.RPC_UPDATE_NAME, Receivers.AllBuffered, main.ifNickname.text);
            networkObject.SendRpc(PlayerBehavior.RPC_UPDATE_ID, Receivers.AllBuffered, networkObject.NetworkId);

            LocalSpawn();
        }

        if (NetworkManager.Instance.Networker is IServer)
        {
            //here you can also do some server specific code
        }
        else
        {
            //setup the disconnected event
            NetworkManager.Instance.Networker.disconnected += DisconnectedFromServer;
        }
    }
Example #20
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        if (isColliding)
        {
            return;
        }

        if (collider.tag == "Terrain" || collider.tag == "Finish")
        {
            isColliding = true;
            flightSound.Stop();
            explosionSound.Play();
            MainScript.KillPlayer();
        }
        else if (collider.tag == "Enemy")
        {
            isColliding = true;
            MainScript.Player.CurrentHealth = MainScript.Player.CurrentHealth - 20;
            if (MainScript.Player.CurrentHealth <= 0)
            {
                flightSound.Stop();
                explosionSound.Play();
                MainScript.KillPlayer();
            }
            else
            {
                whiteSprite();
                isWhite = true;
            }
        }
    }
Example #21
0
    void Awake()
    {
        setLog ();

        Texture2D ci =  (Texture2D)Resources.Load("CorrectSelection", typeof(Texture2D));
        Texture2D ii =  (Texture2D)Resources.Load("IncorrectSelection", typeof(Texture2D));

        correctSelectionIndicator = ci.GetPixels ();
        incorrectSelectionIndicator = ii.GetPixels();

        blackTexture = new Color[width*height];
        for(int i =0; i< width*height; i++)
        {
            blackTexture[i] = Color.black;
        }

        sys = GameObject.Find("System");
        mainScript = sys.GetComponent<MainScript>();

        ServerThread server = new ServerThread();
        Thread st = new Thread(new ThreadStart(server.startServer));
        st.Start();

        Debug.Log("Started Server");

        OSCPhaseSpaceThread oscPSClient = new OSCPhaseSpaceThread();
        Thread oscPSt = new Thread(new ThreadStart(oscPSClient.startServer));
        oscPSt.Start();

        Debug.Log("Started OSC Client");

        OSCThread oscClient = new OSCThread();
        Thread osct = new Thread(new ThreadStart(oscClient.startServer));
        osct.Start();
    }
        public void writeAThing(bool addIndex, MainScript script)
        {
            if (logging)
            {
                string logString = "";
                //tracked objects
                for (int j = 0; j < totalTypes; j++)
                {
                    for (int i = 1; i < totalTypes - 1; i++)
                    {
                        if (orderIDs[i - 1] == j.ToString())
                        {
                            logString += nodeLabels[i - 1];
                            logString += myManifest.getTrackedValueByID(i);
                            logString += sep;
                        }
                    }
                }
                //the date
                logString += secondLastLabel + "(" + System.DateTime.Now.ToString() + ")";
                //the index number
                logString += sep + lastLabel + "(" + indexCount.ToString() + ")";
                indexCount++;
                sw.WriteLine(logString, false);
                sw.Flush();

                //Add the current eye images to their respective lists to be printed later
                textureListR.Add(script.eyeTrackInterpret.GetLiveEyeFootage(0));
                textureListL.Add(script.eyeTrackInterpret.GetLiveEyeFootage(1));
            }
        }
Example #23
0
    // ---- Events Handlers ----

    /// <summary>
    /// Process <see cref="MainScript.State"/> changes;
    /// </summary>
    /// <param name="sender">Must be the <see cref="MainScript"/>.</param>
    /// <param name="e">Ignored</param>
    public void OnStateChange(object sender, EventArgs e)
    {
        MainScript ms = sender as MainScript;

        switch (ms.State)
        {
        case EState.ToGame:
            updateFunction = ToGameBehaviour;
            break;

        case EState.InGame:
            updateFunction = InGameBehaviour;
            break;

        case EState.InMainMenu:
            updateFunction = NotInGameBehaviour;
            break;

        case EState.ToMenu:
            // Completely reset the grid before going to menu.
            ResetGrid();
            firstUpdate    = true;
            updateFunction = NotInGameBehaviour;
            break;

        default:
            updateFunction = NoOpBehaviour;
            break;
        }

        if (ms.State != EState.InGame)
        {
            SetExternCubeletsActive(true);
        }
    }
Example #24
0
 /// <summary>
 /// Конструктор класса
 /// </summary>
 public PageLoader()
 {
     //Инициализируем дефолты
     css    = new MainCss();
     script = new MainScript();
     scene  = new SceneObjectBase();
 }
Example #25
0
 public void Awake()
 {
     instance = this;
     PlayerManager.Instance.Initialize();
     UnitManager.Instance.Initialize();
     wallColliders.geometryType = CompositeCollider2D.GeometryType.Outlines; //starts as poly for cast reasons
 }
Example #26
0
 void Awake()
 {
     if (m_Instance == null)
     {
         m_Instance = this;
     }
 }
Example #27
0
    /// <summary>
    /// Start is called before the first frame update
    /// Second initialization
    /// </summary>
    void Start()
    {
        m_sActiveMenu = gameObject;
        try
        {
#if UNITY_WEBGL
            Console.WriteLine("UnityWebGL works");
#else
            Console.WriteLine("UnityWebGL does not works");
#endif
            SetUserName(NewBehaviourScript.GetUserName());
            _ms = Camera.main.GetComponent <MainScript>();
            Transform rsm = transform.Find("Resume");
            if (rsm != null)
            {
                m_resumeGame = rsm.GetComponent <Button>();
                m_resumeGame.onClick.AddListener(Resume);
                m_exit = transform.Find("Exit").GetComponent <Button>();
                m_exit.onClick.AddListener(_ms.FinishGame);
                m_saveGame = transform.Find("SaveGame").GetComponent <Button>();
                m_saveGame.onClick.AddListener(Save);
                m_loadGame = transform.Find("LoadGame").GetComponent <Button>();
                m_loadGame.onClick.AddListener(Load);
            }
            Settings.SettingsLoad(gameObject);
        }
        catch (Exception ex)
        {
            Debug.LogError("MainMenu Start exception:" + ex.Message);
        }
    }
Example #28
0
    public BattleVisualiser(Battle battle, MainScript mainScript)
    {
        this.mainScript = mainScript;
        Dictionary <BattalionIdentifier, BattalionVisualizer> dictionary = InitializeVisualizers(battle);

        this.unitVisualizers = dictionary.Values;
    }
Example #29
0
    void Start()
    {
        script  = GameObject.Find("toggleManage").GetComponent <toggleManager> ();
        script2 = GameObject.Find("manage").GetComponent <MainScript> ();

        newVege();
    }
Example #30
0
    //private bool wait_service = false;
    //public bool IsWaitService() { return wait_service; }

    // Start is called before the first frame update
    void Start()
    {
        Main = GameObject.Find("Main System").GetComponent <MainScript>();

        //ROSTMSに接続
        RosSocketClient = GameObject.Find("Ros Socket Client").GetComponent <RosSocketClient>();
    }
Example #31
0
 private void Awake()
 {
     OSCHandler.Instance.CreateServer(ServerName, serverIP);
     main = MainScript.Instance;
     var pd = OSCHandler.Instance.Servers[ServerName];
     server = pd.server;
     Debug.Log("OSC: "+server);
 }
Example #32
0
 // Use this for initialization
 void Start()
 {
     //Debug.Log ("CLICK!!!");
     btnTexNorm = GetComponent <SpriteRenderer>().sprite;
     PlayerPrefs.SetInt("Blinking", 0);
     mainS = mainS.GetComponent <MainScript> ();
     tone  = GetComponent <AudioSource> ();
 }
Example #33
0
 private void Start()
 {
     data            = FileManagerScript.LoadData();
     textScore.text  = "Score : " + MainScript.GetScore();
     textScore.text += "\nHighScore : " + data.topScore;
     textScore.text += "\nLightBugs : " + data.currentBugCount;
     textScore.text += "\nTotal Travelled : " + String.Format("{0:.00}", data.totalDistanceTravelled) + "m";
 }
Example #34
0
 public void Start()
 {
     t = true;
     //set speed and hp, get gold
     mainScript = GameObject.FindWithTag("MainScript").GetComponent<MainScript>();
     landEnemySpeed = Random.Range (speedRange.x, speedRange.y);
     landEnemySpeed *= mainScript.constOfDif;
     landEnemyHp *= mainScript.constOfDif;
     landEnemyMaxHp = landEnemyHp;
     MainScript.Gold += 10;
     mainScript.UpdateGui();
 }
Example #35
0
 private void Start()
 {
     mode = 1;
     ms = GameObject.Find("MainScript").GetComponent<MainScript>();
     x = 0;
     y = -1;
     direction = 2;
     ts = GetComponent<TankScript>();
     oldPosition = transform.position;
     cellX = Mathf.RoundToInt(oldPosition.x + 0.5f);
     cellY = Mathf.RoundToInt(oldPosition.z + 0.5f);
 }
Example #36
0
 public void Start()
 {
     mainScript = GameObject.FindWithTag("MainScript").GetComponent<MainScript>();
     airEnemySpeed = Random.Range(airEnemySpeedRange.x, airEnemySpeedRange.y);
     temp = transform.position;
     temp.y = Random.Range(hightRange.x, hightRange.y);
     transform.position = temp;
     airEnemySpeed *= mainScript.constOfDif;
     hp *= mainScript.constOfDif;
     maxHp = hp;
     MainScript.Gold += 10;
     mainScript.UpdateGui();
 }
Example #37
0
	// Use this for initialization
	void Start () 
    {
        ms = GameObject.Find("MainScript").GetComponent<MainScript>();

        poolObjects = new Transform[numberObjectsInPool];

        for (int i = 0; i < numberObjectsInPool; i++)
        {
            poolObjects[i] = (Transform)Instantiate(objectTransform, Vector3.zero, Quaternion.identity);
            poolObjects[i].parent = transform;
            poolObjects[i].gameObject.SetActive(false);
        }
	}
Example #38
0
    // Use this for initialization
    void Start () {
        _instance = this;
        //SingleScript ss = new SingleScript();
        //BattlefieldScript bs = new BattlefieldScript();
		aviable_upgrades = "";
		//aviable_upgrades = "shu1shu2shu3suu1suu2";
		InitOptions ();
		Initlogin ();
		//OpenMenu();
		NowOpenedWindow = "Main";
		LastOpenedWindow = "Main";
		//OpenTratataWindow("Main");

		string name = "Main";
		windows = new List<string>() { "Main", "Solo", "Campain", "Single", "Multiplayer", "Ratings", "Shop", "Options", "Battlefield", "Result", "Login", "Tutorial", "SingleMission", "Wheel"};
		WindowsWithShopOverlay = new List<string> () { "Single", "SingleMission", "Multiplayer", "Shop" };
		List<string> unhideble = new List<string> () { "Sound", "Music" };
		foreach (string s in windows) {
			if (unhideble.IndexOf(s) == -1)
				transform.FindChild (s).gameObject.SetActive (s == name);
		}
		TadamScript.Instance.gameObject.SetActive (false);
		//new Battlefield ();
    }
Example #39
0
 void Start()
 {
     mainScript = GameObject.Find("MainScript").GetComponent<MainScript>();
 }
Example #40
0
 // Use this for initialization
 void Start () {
     _instance = this;
     OpenMenu();
 }
Example #41
0
    void Start()
    {
        ms = GameObject.Find("MainScript").GetComponent<MainScript>();
        mc = this.GetComponent<MeshCollider>();
        mf = this.GetComponent<MeshFilter>();

        myTag = transform.tag;
        if (destroyedBlocks == null)
        {
            destroyedBlocks = new bool[16];
            for (int i = 0; i < 16; i++)
            {
                destroyedBlocks[i] = true;
            }
        }
        if (oldDestroyedBlocks == null)
        {
            oldDestroyedBlocks = new bool[16];
            for (int i = 0; i < 16; i++)
            {
                oldDestroyedBlocks[i] = true;
            }
        }
        
        RefreshBricks();
    }
Example #42
0
    public GameObject waypoint; //The waypoint prefab to create

    #endregion Fields

    #region Methods

    public void awake()
    {
        S = this;
    }
Example #43
0
    // function to be executed once the script started
    void Start()
    {
        if (ms == null)
            ms = this;
        else if (ms != this)
            Destroy (gameObject);

        highScore = PlayerPrefs.GetInt ("High Score", 0);

        hideScoreText ();

        // placing the bird
        Instantiate(birdObject);
        // calling "CreateObstacle" function after 0 seconds, then each 1.5 seconds,
        InvokeRepeating("CreateObstacle", 0f, 1.5f);

        score = 0;

        background = GetComponent<AudioSource> ();

        createGrass (-6.4f);
        createGrass (0f);
        createGrass (6.4f);
        createGrass (12.8f);
    }
Example #44
0
    // Use this for initialization
    void Start()
    {
        // Cache the main script
        mainScript = GameObject.Find("/Codigo").GetComponent<MainScript>();

        if(!mainScript) {

            // DEBUG
            Debug.LogError("MainScript object not found. Check the code.");
        }

        minimapCam = this.camera;

        if(!minimapCam) {

            // DEBUG
            Debug.LogError("Camera object not found for the minimap.");
        }

        if(!mmCubeFocus) {

            // DEBUG
            Debug.LogError("Set a cube object to show the focus on the minimap");
        }

        focusCubeOriginalSize = mmCubeFocus.localScale;

        // Gets the main camera
        mainCamera = Camera.main;

        //
        EnableMinimap();
    }
    // Use this for initialization
    void Start()
    {
        // Calculate the message position on the screen
        fEndMessagePosY = Screen.height - (fEndMessageHeight * 1.5f);
        rectEndMessage = new Rect(Screen.width * 0.5f - fEndMessageWidth * 0.5f,
                fEndMessagePosY, fEndMessageWidth, fEndMessageHeight);

        // Cache the main script
        scriptMainScript = GameObject.Find("/Codigo").GetComponent<MainScript>();

        // Minimap script
        GameObject goMinimapCam = GameObject.FindWithTag("MinimapCam");
        scriptMinimap = goMinimapCam.GetComponent<Minimap>();

        // Hud object
        tHud = GameObject.Find("/HUD").transform;

        goMainCamera = GameObject.FindWithTag("MainCamera");

        // All the monkeys in the game
        lAllMonkeys = scriptMainScript.GetListOfAllMonkeys();

        SetupCameras();
        DeathSequence();
    }
Example #46
0
 // Use this for initialization
 void Start()
 {
     ScriptCtrl = GameObject.Find("ALLScriptCtrl").GetComponent<MainScript>();
 }
Example #47
0
 private void Start()
 {
     ms = GameObject.Find("MainScript").GetComponent<MainScript>();
     timer = ms.otherTime + rateTimer;
 }
    // Use this for initialization
    void Start()
    {
        // Cache the main script
        scriptMainScript = GameObject.Find("/Codigo").GetComponent<MainScript>();

        // Get all needed objects
        camLaunchCam = this.camera;

        // Minimap script
        GameObject goMinimapCam = GameObject.FindWithTag("MinimapCam");
        scriptMinimap = goMinimapCam.GetComponent<Minimap>();

        // Hud object
        tHud = GameObject.Find("/HUD").transform;

        // Rocket Object
        GameObject[] goRockets = GameObject.FindGameObjectsWithTag("Rocket");
        foreach(GameObject goRocket in goRockets) {

            if(goRocket.name == "Rocket") {

                tRocket = goRocket.transform;
                break;
            }
        }

        // Rocket engine thrust
        tRocketThrust = tRocket.transform.Find("RocketThrust");

        if(!tRocketThrust) {

            // DEBUG
            Debug.LogError(this.transform + " cannot find the rocket thrust particle system");
        }

        // Comment the line below to test the launching
        LaunchingSequence();
    }
    public IEnumerator Start()
    {
        speedLevelMax = speeds.Length;
          weaponTypeMax = weapons.Length;

        if (explosionPool == null)   Debug.LogError("You must populate 'explosionPool' with the corresponding object pool located in 'ObjectPools Container'", gameObject);
        if (weapons.Length <= 0) Debug.LogError("You must populate 'weapons'", gameObject);

        myTr = transform;									// We will now use "myTr" instead of "transform"
        mySpriteRdr = myTr.GetComponent<SpriteRenderer>();	// Same as above, we will now use "mySpriteRdr"

        // Reference player's exhaust transform. 'GameObject.Find("PlayerExhaust")' will return the game object named 'Exhaust', which is a child of 'Player'
        myExhaustGo = GameObject.Find("PlayerExhaust"); // (cache component)
        myExhaustTr = myExhaustGo.transform; 			// (cache component)

        // Turn on image
        image = GetComponentInChildren<ImageScript> ();
        image.enabled = true;
        image.wakeUpImage ();
        imgTr = image.imgTr;

        cam = Camera.main; //Get the camera
        mainScript = cam.GetComponent<MainScript>(); // Find MainScript from the camer

        camTr = cam.transform; //Get the camera's transform;
        imgTr.parent = camTr;
        myTr.localPosition = new Vector3 (-1.0f, myTr.localPosition.y, myTr.localPosition.z);

        canMove = true; 			// Can now move
        speed = speeds [speedLevel];

        PrevInputAxis2 = Vector2.zero;
        bringToggled = true;
        fireToggled = true;
          firingLock = false;
        firing = false;

        chargeBarTr = GameObject.Find ("UI_ChargeBar").transform;
        chargeBarSize = Camera.main.aspect * 200f;
        chargeBarSize -= uiScoreScript.pixelLeftSize;
        chargeBarSize -= uiScoreScript.pixelRightSize;
        leftBound = uiScoreScript.screenLeftBound;
        rightBound = uiScoreScript.screenRightBound;

        yield return null;

        if (camScrollVertical == true) {
            image.mySpriteRdr.sprite = playerVertical;
            mySpriteRdr.sprite = playerVertical;
        }
          canShoot = true;
    }
Example #50
0
 void Awake()
 {
     Instance = this;
 }
Example #51
0
    void Start()
    {
        main = MainScript.Instance;

        petitPondCentre = Vector3.zero+(main.littlePond.transform.position-main.bigPond.transform.position)*multDecal;
        petitPondExit = petitPondCentre+Vector3.Normalize(main.bigPond.transform.position-main.littlePond.transform.position)*2f*1f;
        centerPond = petitPondCentre;

        InitValues();

        RandomColors();

        ChangeValuesVirage();
        GenerateBody();
    }
Example #52
0
 // Use this for initialization
 void Start()
 {
     mainScript = Camera.main.GetComponent<MainScript>();
 }
Example #53
0
    // Use this for initialization
    void Start()
    {
        setSlot(1,1);
        nextSlotPosition++;

        if (allMonkeys == null)
            allMonkeys = new ArrayList();
        if (boxYposition == null)
            boxYposition = new ArrayList();
        if (yDirection == null)
            yDirection = new ArrayList();

        playerScript = GameObject.Find("Player").GetComponent<CPlayer>();
        mainScript = GameObject.Find("Codigo").GetComponent<MainScript>();
        eventosMenu = GameObject.Find("Codigo").GetComponent<EventosMenu>();

        mouseWorld = GameObject.Find("Codigo").GetComponent<MouseWorldPosition>();

        boxYmax = 600;
        boxYmin = 670;

        xDirection = 0;
        allRects = new ArrayList();
    }
Example #54
0
 private void Start()
 {
     ms = GameObject.Find("MainScript").GetComponent<MainScript>();
     mr = transform.GetComponent<MeshRenderer>();
 }
Example #55
0
    /*
     * ===========================================================================================================
     * UNITY'S STUFF
     * ===========================================================================================================
     */
    //
    void Start()
    {
        // Cache the main script
        mainScript = GameObject.Find("/Codigo").GetComponent<MainScript>();

        if(!mainScript) {

            // DEBUG
            Debug.LogError("MainScript object not found. Check the code.");
        }
    }
Example #56
0
 // Use this for initialization
 void Start()
 {
     pMain = GameObject.Find ("MainScript").GetComponent<MainScript> ();
     mBoombParticle = GameObject.Instantiate (preBoomb) as ParticleSystem;
     mBoombParticle.transform.parent = transform;
     mBoombParticle.transform.localPosition = new Vector3(0,0,0);
     FirePoint.transform.localPosition = new Vector3(0,0,0);
     ShowMoveTrek ();
     if (ShipType == eShipType.Enemy)//以下代码给PlayerShip使用
         return;
     ShotDirX.text = "0";
     ShotDirY.text = "0";
 }
    public virtual IEnumerator LaunchMusic()
    {
        PreLaunchMusic ();
        Camera cam = Camera.main; // Find MainScript
        mainScript = cam.GetComponent<MainScript>();

        mainScript.StopCoroutine("MusicStop"); // Stop all coroutines relative to the audio in "MainScript"
        mainScript.StopCoroutine("MusicPlay");

        mainScript.GetComponent<AudioSource>().clip = bossMusic;
        mainScript.GetComponent<AudioSource>().Stop();
        playAudioBossTheme = false;
        yield return null;

        mainScript.GetComponent<AudioSource>().loop = true;
        mainScript.GetComponent<AudioSource>().Play();
        PostLaunchMusic ();
    }
Example #58
0
    /*
     * ===========================================================================================================
     * UNITY'S STUFF
     * ===========================================================================================================
     */
    /// <summary>
    /// Executed when the script is loaded
    /// </summary>	
    void Awake()
    {
        Script = this;

        myCam = gameObject.GetComponent<Camera>();

        Transform tCodigo = GameObject.Find("Codigo").transform;
        inputStuffScript = tCodigo.gameObject.GetComponent<MouseWorldPosition>();
        if(inputStuffScript == null) {

            // DEBUG
            Debug.LogError("Cannot find the input script");
        }

        if(micListener == null) {

            // DEBUG
            Debug.LogError("Cannot find the 'microphone' object. Set it in the inspector.");
        }

        mainScript = tCodigo.gameObject.GetComponent<MainScript>();
    }
    // Ustawienia dla poziomów
    void SetLevelSetting(MainScript.TypeOfGame tg)
    {
        if (tg == MainScript.TypeOfGame.Exercise)
        {
            switch (GetLevel())
            {
                case 1:
                    Debug.Log("Starting level " + level);
                    break;
                case 2:
                    Debug.Log("Starting level " + level);
                    break;
                case 3:
                    Debug.Log("Starting level " + level);
                    break;
                case 4:
                    Debug.Log("Starting level " + level);
                    break;
                case 5:
                    Debug.Log("Starting level " + level);
                    break;
                case 6:
                    Debug.Log("Starting level " + level);
                    break;
                case 7:
                    Debug.Log("Starting level " + level);
                    break;
                case 8:
                    Debug.Log("Starting level " + level);
                    break;
                case 9:
                    Debug.Log("Starting level " + level);
                    break;
                case 10:
                    Debug.Log("Starting level " + level);
                    break;
                default:
                    break;
            }
        }
       

   }
Example #60
0
 void Awake()
 {
     network = GameObject.FindObjectOfType<NetworkConnectionPlayerIO>();
     Instance = this;
 }