当前位置: 首页>>代码示例>>C#>>正文


C# GUITexture.GetComponent方法代码示例

本文整理汇总了C#中GUITexture.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# GUITexture.GetComponent方法的具体用法?C# GUITexture.GetComponent怎么用?C# GUITexture.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GUITexture的用法示例。


在下文中一共展示了GUITexture.GetComponent方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FadeToWhite

    void FadeToWhite()
    {
        if (startFade)
        {
            if (whiteBackground == null)
            {
                whiteBackground = (GUITexture)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().whiteBackground);
                whiteBackground.name = "WhiteBackground";

                whiteBackground.gameObject.AddComponent("ResizeGUITexture");
                (whiteBackground.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = whiteBackground.guiTexture;
                (whiteBackground.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();
                SceneManager.Instance.scene.DestroySomeInterfaceElements();
            }

            if (whiteBackground.color.a < 0.5f)
                whiteBackground.color = new Color(
                    whiteBackground.color.r,
                    whiteBackground.color.g,
                    whiteBackground.color.b,
                    whiteBackground.color.a + fadeConst * Time.deltaTime);
            else
            {
                Destroy(whiteBackground);
                whiteBackground = null;
                SceneManager.Instance.scene.CloseScene();
                SceneManager.Instance.ChangeLevelCampaignMode(level);
            }
        }
    }
开发者ID:vitormartins1,项目名称:vermillion-war,代码行数:30,代码来源:FadeBackground.cs

示例2: Start

    public override void Start()
    {
        //-PLAYERAIRPLANE-------------------------------------------------------------------------//
        playerAirplane = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().PlayerAirplane);
        playerAirplane.name = "PlayerAirplane";

        // Setamos a o aviao como alvo da camera
        SmoothFollow.Instance.target = playerAirplane.transform;

        //-SET------------------------------------------------------------------------------------//
        Set = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().Set);
        Set.name = "Set";

        //-LIGHT----------------------------------------------------------------------------------//
        Light = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().Light);
        Light.name = "Light";

        //-INTERFACE-IN-GAME----------------------------------------------------------------------//
        interfaceInGame = (GUITexture)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().interfaceInGame);
        interfaceInGame.name = "InterfaceInGame";

        interfaceInGame.gameObject.AddComponent("ResizeGUITexture");
        (interfaceInGame.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = interfaceInGame.guiTexture;
        (interfaceInGame.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        (interfaceInGame.GetComponent("AirSpeedIndicator") as AirSpeedIndicator).playerAirplane = (this.playerAirplane.GetComponent("PlayerAirplane") as PlayerAirplane);
    }
开发者ID:vitormartins1,项目名称:vermillion-war,代码行数:27,代码来源:SurviveMode.cs

示例3: Start

    public override void Start()
    {
        //-BACKGROUND-----------------------------------------------------------------------------//

        background = (GUITexture)Instantiate(AssetManager.Instance.GetOpeningAssets().background);
        background.name = "OpeningBackground";

        background.gameObject.AddComponent("ResizeGUITexture");
        (background.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = background.guiTexture;
        (background.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //-PRESS-SPACE-BUTTON---------------------------------------------------------------------//

        pressSpaceButton = (GUITexture)Instantiate(AssetManager.Instance.GetOpeningAssets().pressSpaceButton);
        pressSpaceButton.name = "PressSpaceButton";

        pressSpaceButton.gameObject.AddComponent("ResizeGUITexture");
        (pressSpaceButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = pressSpaceButton.guiTexture;
        (pressSpaceButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //----------------------------------------------------------------------------------------//
    }
开发者ID:vitormartins1,项目名称:vermillion-war,代码行数:22,代码来源:Opening.cs

示例4: Start

    public override void Start()
    {
        //-BACKGROUND-----------------------------------------------------------------------------//

        background = (GUITexture)Instantiate(AssetManager.Instance.GetMenuAssets().rankingBackground);
        background.name = "RankingBackground";

        background.gameObject.AddComponent("ResizeGUITexture");
        (background.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = background.guiTexture;
        (background.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //-MENU-BUTTON----------------------------------------------------------------------------//

        menuButton = (GUITexture)Instantiate(AssetManager.Instance.GetMenuAssets().menuButton);
        menuButton.name = "MenuButton";

        menuButton.gameObject.AddComponent("ResizeGUITexture");
        (menuButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = menuButton.guiTexture;
        (menuButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //----------------------------------------------------------------------------------------//
    }
开发者ID:vitormartins1,项目名称:vermillion-war,代码行数:22,代码来源:RankingMenu.cs

示例5: Start

    public override void Start()
    {
        //-PLAYERAIRPLANE-------------------------------------------------------------------------//
        playerAirplane = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().PlayerAirplane);
        playerAirplane.name = "PlayerAirplane";

        // Setamos a o aviao como alvo da camera
        SmoothFollow.Instance.target = playerAirplane.transform;

        //-ENEMYAIRPLANE--------------------------------------------------------------------------//

        enemyAirplane = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().EnemyAirplane);
        enemyAirplane.name = "EnemyAirplane";
        (enemyAirplane.GetComponent("EnemyAirplane") as EnemyAirplane).targetAirplane = playerAirplane.transform;

        //-ENEMYAIRPLANE--------------------------------------------------------------------------//

        enemyAirplane2 = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().EnemyAirplane);
        enemyAirplane2.transform.position = new Vector3(Random.Range(0,100), enemyAirplane2.transform.position.y, enemyAirplane2.transform.position.z);
        enemyAirplane2.name = "EnemyAirplane";
        (enemyAirplane2.GetComponent("EnemyAirplane") as EnemyAirplane).targetAirplane = playerAirplane.transform;

        //-ENEMYAIRPLANE--------------------------------------------------------------------------//

        enemyAirplane3 = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().EnemyAirplane);
        enemyAirplane3.transform.position = new Vector3(enemyAirplane3.transform.position.x, enemyAirplane3.transform.position.y , Random.Range(0,100));
        enemyAirplane3.name = "EnemyAirplane";
        (enemyAirplane3.GetComponent("EnemyAirplane") as EnemyAirplane).targetAirplane = playerAirplane.transform;

        //-SET------------------------------------------------------------------------------------//
        Set = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().Set);
        Set.name = "Set";

        //-LIGHT----------------------------------------------------------------------------------//
        Light = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().Light);
        Light.name = "Light";

        //-INTERFACE-IN-GAME----------------------------------------------------------------------//
        interfaceInGame = (GUITexture)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().interfaceInGame);
        interfaceInGame.name = "InterfaceInGame";

        interfaceInGame.gameObject.AddComponent("ResizeGUITexture");
        (interfaceInGame.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = interfaceInGame.guiTexture;
        (interfaceInGame.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        (interfaceInGame.GetComponent("AirSpeedIndicator") as AirSpeedIndicator).playerAirplane = (this.playerAirplane.GetComponent("PlayerAirplane") as PlayerAirplane);

        base.Start();
    }
开发者ID:vitormartins1,项目名称:vermillion-war,代码行数:49,代码来源:Level_01.cs

示例6: Start

    public override void Start()
    {
        MenuAssets ma = AssetManager.Instance.GetMenuAssets();

        //-BACKGROUND-----------------------------------------------------------------------------//

        background = (GUITexture)Instantiate(ma.menuBackground);
        background.name = "MenuBackground";

        background.gameObject.AddComponent("ResizeGUITexture");
        (background.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = background.guiTexture;
        (background.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //-CAMPAIGN-BUTTON------------------------------------------------------------------------//

        campaignButton = (GUITexture)Instantiate(ma.campaignButton);
        campaignButton.name = "CampaignButton";

        campaignButton.gameObject.AddComponent("ResizeGUITexture");
        (campaignButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = campaignButton.guiTexture;
        (campaignButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //-SURVIVE-BUTTON-------------------------------------------------------------------------//

        surviveButton = (GUITexture)Instantiate(ma.surviveButton);
        surviveButton.name = "SurviveButton";

        surviveButton.gameObject.AddComponent("ResizeGUITexture");
        (surviveButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = surviveButton.guiTexture;
        (surviveButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //-CREDITS-BUTTON-------------------------------------------------------------------------//

        creditsButton = (GUITexture)Instantiate(ma.creditsButton);
        creditsButton.name = "CreditsButton";

        creditsButton.gameObject.AddComponent("ResizeGUITexture");
        (creditsButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = creditsButton.guiTexture;
        (creditsButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //-RANKING-BUTTON-------------------------------------------------------------------------//

        rankingButton = (GUITexture)Instantiate(ma.rankingButton);
        rankingButton.name = "RankingButton";

        rankingButton.gameObject.AddComponent("ResizeGUITexture");
        (rankingButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = rankingButton.guiTexture;
        (rankingButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //-INSTRUCTIONS-BUTTON--------------------------------------------------------------------//

        instructionsButton = (GUITexture)Instantiate(ma.instructionsButton);
        instructionsButton.name = "InstructionsButton";

        instructionsButton.gameObject.AddComponent("ResizeGUITexture");
        (instructionsButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = instructionsButton.guiTexture;
        (instructionsButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //-QUIT-BUTTON----------------------------------------------------------------------------//

        quitButton = (GUITexture)Instantiate(ma.quitButton);
        quitButton.name = "QuitButton";

        quitButton.gameObject.AddComponent("ResizeGUITexture");
        (quitButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = quitButton.guiTexture;
        (quitButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

        //----------------------------------------------------------------------------------------//

        ma = null;
    }
开发者ID:vitormartins1,项目名称:vermillion-war,代码行数:71,代码来源:MainMenu.cs

示例7: Start

    //-----------------------------------------------------
    void Start()
    {
        // -- GUITexture du logo (ratio fixe) --
        string logoPath = (usefullData._edition == usefullData.OSedition.Lite? m_logoExpressPath: m_logoFullPath);
        Texture logoTex = (Texture2D) Resources.Load(logoPath, typeof(Texture2D));
        if(logoTex == null)
            Debug.LogError(DEBUGTAG+logoPath+" "+PC.MISSING_RES);

        if(transform.childCount > 0)
        {
            mLogoGUItex = transform.GetChild(0).transform.GetComponent<GUITexture>();
            mLogoGUItex.GetComponent<GUITexture>().texture = logoTex;
        }

           /* if(mLogoGUItex == null || mLogoGUItex.guiTexture.texture == null)
        {
            Debug.LogError(DEBUGTAG+"Logo GUItexture not found or texture not assigned."); this.enabled = false;
        }*/

        // -- Texture de fond pendant montage --
           /* if(mMontageBgTex == null)
            { Debug.LogError(DEBUGTAG+"Texture not found... Deactivating script."); this.enabled = false;}*/

        // -- Textures loading & menu : chargement selon la résolution de l'écran --
        mLoadingBgTex     = null;
        mMenuBgTex        = null;

        string    bgFormat = ChooseBestBgRatio(UnityEngine.Screen.width, UnityEngine.Screen.height);
        Object[]  bgObj    = Resources.LoadAll("gui/backgrounds/"+bgFormat, typeof(Texture));
        Texture   curTex;
        for(int i=0; i<bgObj.Length; i++)
        {
            curTex = (Texture) bgObj[i];
            //Debug.Log(DEBUGTAG+" found splash : "+curTex.name);
            if(curTex.name.Contains(mLoadingBgFilename))
                mLoadingBgTex = curTex;

            if(curTex.name.Contains(mMainmenuBgFilename))
                mMenuBgTex = curTex;

        //            else if(PC.DEBUG && DEBUG)
        //                Debug.LogWarning(DEBUGTAG+"Found unknown splash texture : "+curTex.name);
        }

        // -- Erreurs si images non trouvées --
           /* if(mLoadingBgTex == null)
        {
            Debug.LogError(DEBUGTAG+"Splash not found : "+mLoadingBgFilename+" for format \""+bgFormat+"\"");
            mLoadingBgTex = (Texture) Resources.Load("gui/backgrounds/"+sBgMissingFilename, typeof(Texture));
        }
        if(mMenuBgTex   == null)
        {
            Debug.LogError(DEBUGTAG+"Splash not found : "+mMainmenuBgFilename+" for format \""+bgFormat+"\"");
            mMenuBgTex = (Texture) Resources.Load("gui/backgrounds/"+sBgMissingFilename, typeof(Texture));
        }*/

        // -- Configuration initiale --

        SetLoadingMode();
    }
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:61,代码来源:BackGridManager.cs

示例8: AttemptItemPutDown

    // Called when an invetory held under the mouse cursor is dropped
    // Returns true if successful
    public bool AttemptItemPutDown(GUITexture item)
    {
        int inventorySlot = InventorySlotUnderPoint(
            new Vector2(Input.mousePosition.x, Input.mousePosition.y));
        int equipmentSlot = EquipmentSlotUnderPoint(
            new Vector2(Input.mousePosition.x, Input.mousePosition.y));

        // add item to inventory
        if(inventorySlot != -1)
        {
            // SWAP if necessary
            if(_items[inventorySlot] != null)
            {
                _items[inventorySlot].GetComponent<ItemTextureControls>().InventorySlot = -1;
                _items[inventorySlot].GetComponent<ItemTextureControls>().PickedUp = true;
                ItemPickedUpInventory(inventorySlot);
            }
            else
            {
                _itemPickedUp = null;
            }

            // Place item in inventory
            _items[inventorySlot] = item;
            item.transform.parent = _inventorySlots[inventorySlot].transform;
            item.transform.localPosition = new Vector3(0,0,2);
            item.pixelInset =
            new Rect(_inventorySlots[inventorySlot].pixelInset.xMin,
                    _inventorySlots[inventorySlot].pixelInset.yMin,
                    _inventorySlots[inventorySlot].pixelInset.width,
                    _inventorySlots[inventorySlot].pixelInset.height);
            item.GetComponent<ItemTextureControls>().InventorySlot = inventorySlot;
        }
        // place in equipment
        else if(equipmentSlot != -1)
        {
            // wrong equipment slot clicked; do nothing
            if(! EquipmentSlotCheckItemCompatability(equipmentSlot,
                item.GetComponent<ItemData>().itemClass))
            {
                return false;
            }

            // SWAP if necessary
            if(_equippedItems[equipmentSlot] != null)
            {
                _equippedItems[equipmentSlot].GetComponent<ItemTextureControls>().EquipmentSlot = -1;
                _equippedItems[equipmentSlot].GetComponent<ItemTextureControls>().PickedUp = true;
                ItemPickedUpEquipment(equipmentSlot);
            }
            else
            {
                _itemPickedUp = null;
            }

            // Place item in equipment
            _equippedItems[equipmentSlot] = item;
            item.transform.parent = _equippedSlots[equipmentSlot].transform;
            item.transform.localPosition = new Vector3(0,0,2);
            item.pixelInset =
            new Rect(_equippedSlots[equipmentSlot].pixelInset.xMin,
                    _equippedSlots[equipmentSlot].pixelInset.yMin,
                    _equippedSlots[equipmentSlot].pixelInset.width,
                    _equippedSlots[equipmentSlot].pixelInset.height);
            item.GetComponent<ItemTextureControls>().EquipmentSlot = equipmentSlot;

            if(equipmentSlot == 4 || equipmentSlot == 5)
            {
                UpdateHandheldItemSprites();
            }
        }
        // drop item
        else
        {
            OTSprite newpickup = OT.CreateObject("pickup").GetComponent<OTSprite>();

            newpickup.position =
                    self.position - new Vector2(10,0);
            newpickup.gameObject.AddComponent<ItemData>();
            newpickup.GetComponent<ItemData>().SetValues(item.GetComponent<ItemData>());
            newpickup.frameName = newpickup.GetComponent<ItemData>().itemType.ToString();

            _itemPickedUp = null;

            Destroy(item.gameObject);
        }

        RecalcStats();
        return true;
    }
开发者ID:rtm907,项目名称:C--Unity-Game-Exercise,代码行数:92,代码来源:HeroManager.cs

示例9: CallIntroduction

    public virtual void CallIntroduction()
    {
        if (firstTimeIntroduction)
        {
            timer += Time.deltaTime;

            if (timer >= 3)
            {
                SceneManager.Instance.paused = true;

                CampaignAndSurviveModeAssets csma = AssetManager.Instance.GetCampaignAndSurviveModeAssets();

                //-RESTART-BUTTON-------------------------------------------------------------------------//

                restartButton = (GUITexture)Instantiate(csma.restartButton);
                restartButton.name = "RestartButton";

                restartButton.gameObject.AddComponent("ResizeGUITexture");
                (restartButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = restartButton.guiTexture;
                (restartButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

                //-CONTINUE-BUTTON------------------------------------------------------------------------//

                continueButton = (GUITexture)Instantiate(csma.continueButton);
                continueButton.name = "ContinueButton";

                continueButton.gameObject.AddComponent("ResizeGUITexture");
                (continueButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = continueButton.guiTexture;
                (continueButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

                //-MENU-IN-GAME-BUTTON--------------------------------------------------------------------//

                menuInGameButton = (GUITexture)Instantiate(csma.menuInGameButton);
                menuInGameButton.name = "MenuInGameButton";

                menuInGameButton.gameObject.AddComponent("ResizeGUITexture");
                (menuInGameButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = menuInGameButton.guiTexture;
                (menuInGameButton.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

                //-INTRODUCTION-CHAPTER-01----------------------------------------------------------------//
                introduction = (GUITexture)Instantiate(introductionPrefab);
                introduction.name = "Introduction";

                introduction.gameObject.AddComponent("ResizeGUITexture");
                (introduction.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = introduction.guiTexture;
                (introduction.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();

                firstTimeIntroduction = false;
            }
        }
    }
开发者ID:vitormartins1,项目名称:vermillion-war,代码行数:51,代码来源:Introduction.cs


注:本文中的GUITexture.GetComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。