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


C# Grid.GetComponent方法代码示例

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


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

示例1: Start

    // Use this for initialization
    void Start()
    {
        tier = 1;

        grid = GameObject.FindGameObjectWithTag ("Grid").GetComponent<Grid> ();
        render = GetComponent<SpriteRenderer>();
        selection = grid.GetComponent<SelectionManager> ();
    }
开发者ID:Rakosi,项目名称:CodeNConquer,代码行数:9,代码来源:ResearchBuilding.cs

示例2: MapRenderer

    public MapRenderer()
    {
        tileSheetTiles = Resources.Load("download", typeof(Texture2D)) as Texture2D;
        tileSheetShadows = Resources.Load("Shadows", typeof(Texture2D)) as Texture2D;

        map = new GameObject("map").AddComponent<Grid>();
        map.transform.position = new Vector3(-0.5F, -0.5F, 0);
        map.GetComponent<MeshRenderer>().materials = new Material[] { Resources.Load("SpriteSheet", typeof(Material)) as Material };

        shadows = new GameObject("shadows").AddComponent<Grid>();
        shadows.gameObject.layer = LayerMask.NameToLayer("Shadows");
        shadows.transform.position = new Vector3(-0.5F, -0.5F, -0.5F);
        shadows.GetComponent<MeshRenderer>().materials = new Material[] { Resources.Load("ShadowsMaterial", typeof(Material)) as Material };
    }
开发者ID:stijnhero,项目名称:Game,代码行数:14,代码来源:MapRenderer.cs

示例3: Start

    // Use this for initialization
    void Start()
    {
        //This will change as tier increases later
        tier = 1;
        infantryTime = 100;
        cavalryTime = 200;

        //Initialize the soldier queue
        soldiers = new Queue ();
        grid = GameObject.FindGameObjectWithTag ("Grid").GetComponent<Grid> ();
        render = GetComponent<SpriteRenderer>();
        selection = grid.GetComponent<SelectionManager> ();

        health = GetComponentInChildren<Health> ();

        cavalryDmg = 15; cavalryArmor = 5; cavalryHealth = 125;
        infantryDmg = 10; infantryArmor = 0; infantryHealth = 100;

        armorAval = false;attackAval = false;upgradeAval = false;
        armorLevel = 1;attackLevel = 1;
    }
开发者ID:Rakosi,项目名称:CodeNConquer,代码行数:22,代码来源:Barracks.cs

示例4: Start

    // Use this for initialization
    void Start()
    {
        //This will change as tier increases later
        tier = 1;
        archerTime = 120;

        //Initialize the soldier queue
        soldiers = new Queue ();
        grid = GameObject.FindGameObjectWithTag ("Grid").GetComponent<Grid> ();
        render = GetComponent<SpriteRenderer>();
        selection = grid.GetComponent<SelectionManager> ();
    }
开发者ID:Rakosi,项目名称:CodeNConquer,代码行数:13,代码来源:Archery.cs

示例5: Awake

    // Initialize the components of the infantry
    void Awake()
    {
        grid = GameObject.FindGameObjectWithTag ("Grid").GetComponent<Grid> ();
        render = GetComponent<SpriteRenderer>();
        Selection = grid.GetComponent<SelectionManager> ();
        cam = grid.transform.Find("Camera").GetComponent<Camera>();
        body = GetComponent<Rigidbody2D>();

        point = transform.position;
        ordered = -1; //No order has ben given
        pathOrdered = new Stack ();
        target = null;
        targetLoc = new Vector2 (0, 0);
        targetSighted = new Vector2 (0, 0);
        counter = 100;
        awareness = 100;
    }
开发者ID:Rakosi,项目名称:CodeNConquer,代码行数:18,代码来源:Soldier.cs


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