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


C# GameManager.GetComponent方法代码示例

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


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

示例1: Start

 // Use this for initialization
 void Start()
 {
     gm = GameObject.FindObjectOfType<GameManager> ();
     audos = gm.GetComponent<AudioSource>();
     onDown = Resources.Load ("Audio/switch") as AudioClip;
     onExit = Resources.Load ("Audio/Click2") as AudioClip;
     onEnter = Resources.Load ("Audio/Click2") as AudioClip;
 }
开发者ID:MatejMinarik,项目名称:The-Light-Beyond,代码行数:9,代码来源:InGameMenuSound.cs

示例2: Start

    // Use this for initialization
    void Start()
    {
        rend = GetComponent<Renderer>();
        origCol = rend.material.GetColor("_Color");
        origEmis = rend.material.GetColor("_EmissionColor");
        gameMan = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>();

        // register ourselves
        gameMan.GetComponent<EnvironmentManager>().envObjs.Add(gameObject);
    }
开发者ID:izzy-sabur,项目名称:polish_proj,代码行数:11,代码来源:ColorChangeOnWin.cs

示例3: Start

 /// <summary>
 /// Use for initialization
 /// </summary>
 public override void Start()
 {
     base.Start();
     if (isWandering)
     {
         velocity = new Vector3(0,0,0);
     }
     obstacles = GameObject.FindGameObjectsWithTag("Obstacle");
     gm = GameObject.Find("GameManager").GetComponent<GameManager>();
     targetFlock = gm.GetComponent<GameManager>().Flock;
     myCharTarget = GameObject.FindGameObjectWithTag("MainPlayer");
     targetsEaten = new List<GameObject>();
 }
开发者ID:Tsuzee,项目名称:UnityThemePark,代码行数:16,代码来源:Wanderer.cs

示例4: Init

    // Use this for initialization
    public void Init()
    {
        gm = Camera.main.GetComponent<GameManager>();
        curBPdelay = BPdelay;
        maxHealth = health;

        inv = transform.GetComponent<Inventory>();
        inv.Init((int)inventorySize.x, (int)inventorySize.y);

        invD = gm.GetComponent<InvDisp>();
        invD.Init((int)inventorySize.x, (int)inventorySize.y);

        healthBar = gm.PlayerHealthBar;
        damageImage = gm.PlayerDamageImage;
        InfoText = gm.InfoText;

        healthBar.maxValue = maxHealth;
        healthBar.value = health;
    }
开发者ID:IndustrialReaver,项目名称:ExTerra,代码行数:20,代码来源:PlayerControls.cs

示例5: load

    public void load(string s)
    {
        Debug.Log("PlayerControls::load -- " + s);
        string[] values = s.Split(':');
        gameObject.name = values[0];
        transform.position = new Vector2(float.Parse(values[1]), float.Parse(values[2]));
        health = int.Parse(values[3]);
        maxHealth = int.Parse(values[4]);

        gm = Camera.main.GetComponent<GameManager>();
        curBPdelay = BPdelay;

        inv = transform.GetComponent<Inventory>();
        inv.Init((int)inventorySize.x, (int)inventorySize.y);
        string loadinv = values[5];
        inv.load(loadinv);

        invD = gm.GetComponent<InvDisp>();
        invD.Init((int)inventorySize.x, (int)inventorySize.y);

        healthBar = gm.PlayerHealthBar;
        damageImage = gm.PlayerDamageImage;

        healthBar.maxValue = maxHealth;
        healthBar.value = health;
    }
开发者ID:IndustrialReaver,项目名称:ExTerra,代码行数:26,代码来源:PlayerControls.cs

示例6: Start

    void Start()
    {
        gameManager = GameObject.FindWithTag("GameManager").GetComponent<GameManager>();
        gameManager.Register_Clipboard(this);
        localizedTextManager = gameManager.GetComponent<LocalizedTextManager>();

        buttonTextComponent = GetComponentInChildren<Text>();

        offscreenPosition = new Vector3(transform.position.x, transform.position.y - offscreenOffset, transform.position.z);
        offscreenScale = transform.localScale * offscreenScalar;
        originalPosition = transform.position;
        originalScale = transform.localScale;

        createAndDestroyLevelRef = GameObject.FindGameObjectWithTag("persistentObject").GetComponent<CreateAndDestroyAppointment>();

        selectorRef = GameObject.Find("LevelSelector").GetComponent<LevelSelector>();
        createAndDestroyLevelRef.levelsAvailable = selectorRef.dayToGenerate.numAppointments;

        CreateAllAppointments();

        // place badges
        badgeCheckOriginalPos = badgeCheck.transform.localPosition;
        badgeStarOriginalPos = badgeStar.transform.localPosition;
        badgeCheck.transform.position = new Vector3(badgeCheck.transform.position.x, badgeCheck.transform.position.y + distanceToPushBadges, badgeCheck.transform.position.z);
        badgeStar.transform.position = new Vector3(badgeStar.transform.position.x, badgeStar.transform.position.y + distanceToPushBadges, badgeStar.transform.position.z);

        // place showMe banner
        Vector3 showMeScreenEdge = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width * showMeBannerScreenPos_X, Screen.height * showMeBannerScreenPos_Y));
        showMeOutPosition = new Vector3(
            showMeScreenEdge.x,
            showMeScreenEdge.y,
            showMeBanner.transform.position.z);
        showMeInPosition = new Vector3(showMeOutPosition.x - distanceToPushShowMeBanner, showMeOutPosition.y, showMeOutPosition.z);
        showMeBanner.transform.position = showMeInPosition;

        // show notifications at start of clipboard
        if (selectorRef.dayToGenerate.dayIndex_internal == 0)
        {
            GameObject.Find("NotificationManager").GetComponent<NotificationManager>().DisplayNotification(1, false);
        }
        else if (selectorRef.dayToGenerate.dayIndex_internal == 4)
        {
            GameObject.Find("NotificationManager").GetComponent<NotificationManager>().DisplayNotification(9, false);
        }

        textDay.text = localizedTextManager.GetLocalizedString("Day") + " " + (selectorRef.dayToGenerate.dayIndex_internal + 1);

        restartFromResultsScreenButton = GameObject.Find("RestartFromResultsScreenButton");
        ShowRestartButton(false);

        isFirstCreation = false;
    }
开发者ID:nickhester,项目名称:SocialNetwork,代码行数:52,代码来源:Clipboard.cs

示例7: Start

    // this prefab has been created and needs "setting up"
    void Start()
    {
        gameMan = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>();
        misMan = gameMan.GetComponent<MissionManager>();

        // create the player and their spawn animation
        CreatePlayerSpawnAnimation();
        Invoke("DelayPlayerSpawn", 1f);

        // create the header, set string and transition it in
        CreateCustomHeader();

        transitionCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(.5f, 1.15f, -.3f, -.3f), new Keyframe(1.0f, 1.0f));

        // if we're spawning a disc for this mission
        if (spawnDisc)
        {
          CreateDiscSpawnAnimation();
          Invoke("DelayDiscSpawn", misMan.spawnDelay);
        }
    }
开发者ID:izzy-sabur,项目名称:polish_proj,代码行数:22,代码来源:BaseMission.cs

示例8: Start

    // Use this for initialization
    void Start()
    {
        inputManager = InputManager.Instance;

        gameManager = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameManager>();
        uiManager = gameManager.GetComponent<UIManager>();
        spawnManager = gameManager.GetComponent<EnemySpawnManager>();

        playerInfo = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerBehaviour>();

        healthButton = gameObject.transform.FindChild("Button_Health").gameObject;
        pierceButton = gameObject.transform.FindChild("Button_Pierce").gameObject;
        damageButton = gameObject.transform.FindChild("Button_Damage").gameObject;
        turretButton = gameObject.transform.FindChild("Button_Turret").gameObject;
        closeButton = gameObject.transform.FindChild("Button_Close").gameObject;

        buttonList.Add(healthButton);
        buttonList.Add(pierceButton);
        buttonList.Add(damageButton);
        buttonList.Add(turretButton);
        buttonList.Add(closeButton);

        healthPriceDisplay[0] = healthButton.transform.FindChild("Price_Ones").gameObject;
        healthPriceDisplay[1] = healthButton.transform.FindChild("Price_Tens").gameObject;
        healthPriceDisplay[2] = healthButton.transform.FindChild("Price_Hundreds").gameObject;

        piercePriceDisplay[0] = pierceButton.transform.FindChild("Price_Ones").gameObject;
        piercePriceDisplay[1] = pierceButton.transform.FindChild("Price_Tens").gameObject;
        piercePriceDisplay[2] = pierceButton.transform.FindChild("Price_Hundreds").gameObject;

        damagePriceDisplay[0] = damageButton.transform.FindChild("Price_Ones").gameObject;
        damagePriceDisplay[1] = damageButton.transform.FindChild("Price_Tens").gameObject;
        damagePriceDisplay[2] = damageButton.transform.FindChild("Price_Hundreds").gameObject;

        turretPriceDisplay[0] = turretButton.transform.FindChild("Price_Ones").gameObject;
        turretPriceDisplay[1] = turretButton.transform.FindChild("Price_Tens").gameObject;
        turretPriceDisplay[2] = turretButton.transform.FindChild("Price_Hundreds").gameObject;

        closeDelayTimer = new Timer(CLOSE_DELAY_TIME);

        inputManager.Key_Pressed += ProcessMouseClick;
        spawnManager.WaveStart += OnWaveStart;
        closeDelayTimer.OnTimerComplete += SetClosed;
        gameManager.GameOverEvent += OnGameOver;
    }
开发者ID:ToaLetan,项目名称:Relentless,代码行数:46,代码来源:ShopManager.cs

示例9: Start

    // Use this for initialization
    void Start()
    {
        gameMan = GameObject.FindGameObjectWithTag("Manager").GetComponent<GameManager>(); ;
        maxScore = gameMan.GetComponent<ScoreManager>().gamesToWin;
        pBackgrounds = new GameObject[gameMan.numPlayers];
        p1ScoreIcons = new ArrayList();
        p2ScoreIcons = new ArrayList();

        p1Color = gameMan.pColor[0];
        p2Color = gameMan.pColor[1];
        lastP1Icon = maxScore;
        lastP2Icon = maxScore;

        bulgeCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(.5f, 1.6f), new Keyframe(1.0f, 1.0f));
        flashCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(.5f, 1.0f), new Keyframe(1.0f, 0));
    }
开发者ID:izzy-sabur,项目名称:polish_proj,代码行数:17,代码来源:Scoreboard.cs


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