• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SpriteRenderer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SpriteRenderer的典型用法代码示例。如果您正苦于以下问题:C# SpriteRenderer类的具体用法?C# SpriteRenderer怎么用?C# SpriteRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SpriteRenderer类属于命名空间,在下文中一共展示了SpriteRenderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Start

	// Use this for initialization
	protected override void Start () 
	{
		base.Start ();

		//load stats
		EnemyStats stats = LevelDesign.GetEnemyStats(type);
		if(stats != null)
			vel = stats.vel;
		
		isSlowed = GameController.IsSlowedDown;

		vel += LevelDesign.EnemiesBonusVel;

		myRigidbody2D = GetComponent<Rigidbody2D> ();

		if(transform.FindChild("Sprite") != null)
			spriteRenderer = transform.FindChild("Sprite").GetComponent<SpriteRenderer>();

		myRigidbody2D.velocity = transform.right * vel;

		if (GameController.IsSlowedDown)
			ApplySlow ();

		StartCoroutine (WaitForPosition ());

		onEnterRangeList = new List<EventDelegate> ();
		onEnterRangeList.Add (onEnterRange);
	}
开发者ID:OvertimeStudios,项目名称:CreepyBuster,代码行数:29,代码来源:RandomMovement.cs


示例2: Start

 protected virtual void Start()
 {
     decayLevel = 0;
     maxDecayLevel = DecayStates.Length;
     spriteRenderer = GetComponent<SpriteRenderer>();
     boxCollider = GetComponent<BoxCollider2D>();
 }
开发者ID:urgamedev,项目名称:LudumDare33,代码行数:7,代码来源:Decayable.cs


示例3: Start

	// Use this for initialization
	void Start () 
	{
		currentHealth = maxHealth;
		currentInvincibilityTime = maxInvincibilityTime;
		rend = GetComponent<SpriteRenderer> ();
		Time.timeScale = 1;
	}
开发者ID:Kpatena,项目名称:GJamGame,代码行数:8,代码来源:Playerhealth.cs


示例4: Start

	// Use this for initialization
	void Start () {

		//Get a component reference to the Character's animator component
		animator = GetComponent<Animator>();
		render = GetComponent<SpriteRenderer>();

		//Get the rigid body on the prefab
		bullBody = GetComponent<Rigidbody2D>();

		//Set our bullet strength and speed
		strength = 4;
		speed = 40;

		//Go after our player!
		player = GameObject.Find("Player").GetComponent<Player>();

		//Get our Player current Direction
		if (player.getDirection () > 0 ||
			(player.getDirection() == 0 && player.getLastDirection() > 0 )) {
			animator.SetInteger ("Direction", 1);
			playerRight = true;
		} else {
			playerRight = false;
			animator.SetInteger ("Direction", -1);
		}

		//Play our shooting sound
		shoot = GameObject.Find ("Shoot").GetComponent<AudioSource> ();

			shoot.Play ();

		//Get our camera script
		actionCamera = Camera.main.GetComponent<ActionCamera>();
	}
开发者ID:julianpoy,项目名称:HackPoly2016,代码行数:35,代码来源:Bullets.cs


示例5: Start

		void Start ()
		{
				if (messageObject == null) {
					messageObject = gameObject;
				}
				spriteRendererComp = GetComponent<SpriteRenderer> ();
		}
开发者ID:finian826,项目名称:Unity-A-Z,代码行数:7,代码来源:Button.cs


示例6: Awake

 void Awake()
 {
     sprite = GetComponent<SpriteRenderer>();
     body = GetComponent<Rigidbody2D>();
     col = GetComponent<BoxCollider2D>();
     parentBalista = transform.parent.gameObject;
 }
开发者ID:KneeDeepAudio,项目名称:CauseAndEffect,代码行数:7,代码来源:BallistaArrow.cs


示例7: init

	public void init () {
//		trans = transform;
//		newPos = trans.localPosition;
//		initX = newPos.x;
//		maxX = initX + .16f;
		render = GetComponent<SpriteRenderer>();
	}
开发者ID:aintech,项目名称:Heroes_of_Routine,代码行数:7,代码来源:Enemy.cs


示例8: Awake

    void Awake()
    {
        Sprite = this.gameObject.GetComponent<SpriteRenderer>();
        var aleatorio = UnityEngine.Random.Range(0, 10);
        if(Application.loadedLevel !=4)
        {
            if (aleatorio > 0 && aleatorio <= PosibilidadAcelerar)
            {
                PowerActual = TipoPower.Aceleracion;
                Sprite.color = Color.green;
            }
            else if (aleatorio > PosibilidadAcelerar && aleatorio <= PosibilidadCongelar)
            {
                PowerActual = TipoPower.CongelarBasura;
                Sprite.color = Color.blue;
            }
            else if (aleatorio > PosibilidadCongelar && aleatorio <= 7)
            {
                PowerActual = TipoPower.Proteccion;
                Sprite.color = Color.gray;
            }

        }

         if (aleatorio == 8)
        {
            PowerActual = TipoPower.Desacelerar;
            Sprite.color = Color.red;
        }
        else
        {
            PowerActual = TipoPower.Quemar;
            Sprite.color = Color.yellow;
        }
    }
开发者ID:Jeanlo,项目名称:Snake-RoboVacumm-2015,代码行数:35,代码来源:PowerScript.cs


示例9: Awake

 //private Score score;				// Reference to the Score script.
 void Awake()
 {
     // Setting up the references.
     ren = transform.Find("body").GetComponent<SpriteRenderer>();
     frontCheck = transform.Find("frontCheck").transform;
     //score = GameObject.Find("Score").GetComponent<Score>();
 }
开发者ID:nabinchha,项目名称:the-poopy-bird,代码行数:8,代码来源:Enemy.cs


示例10: Start

	// Use this for initialization
	void Start () {
		Application.targetFrameRate = 60;

		if(!GlobalData.isMuted)
		{
			audio1.Play();
			audio2.Play();
		}

		cTransform = GetComponent<Transform>();
		time = 0;
		rend = GetComponent<SpriteRenderer>();
		switch(GlobalData.selectedGod)
		{
			case GlobalData.Gods.RHINO:
				rend.sprite = SpriteManager.GetInstance().sprites["rhino_select"];
				break;
			case GlobalData.Gods.BEAR:
				rend.sprite = SpriteManager.GetInstance().sprites["bear_select"];
				break;
			case GlobalData.Gods.BULL:
				rend.sprite = SpriteManager.GetInstance().sprites["bull_select"];
				break;
		}
		Camera.main.GetComponent<Shake>().ShakeCamera(0.6f, 60,60);
	}
开发者ID:jivanecky,项目名称:PartyGodsIPHONE,代码行数:27,代码来源:SelectEffect.cs


示例11: Start

	void Start()
	{
		base.Start();
		controller = GetComponent<Controller2D>();
		spriteRenderer = GetComponent<SpriteRenderer>();
		enemySpeed = -enemySpeed;
	}
开发者ID:nzhul,项目名称:ritual,代码行数:7,代码来源:Enemy.cs


示例12: Start

 void Start()
 {
     _spriteRenderer = GetComponent<SpriteRenderer>();
     _boxCollider = GetComponent<BoxCollider2D>();
     _isLaserVisible = isLaserVisibleOnStart;
     ChangeLaserApperance ();
 }
开发者ID:zgredziucha,项目名称:areria,代码行数:7,代码来源:LaserBlink.cs


示例13: Start

 //public GameObject box;
 void Start()
 {
     this.GetComponent<Collider2D>().enabled = false;
     Sr = this.GetComponent<SpriteRenderer>();
     this.layer = Sr.sortingOrder;
     top = GeneralAttrib.maxi;
 }
开发者ID:Xidrovo,项目名称:PullAway-Imadori,代码行数:8,代码来源:AttribBalsa.cs


示例14: Start

 // Use this for initialization
 void Start()
 {
     caster = gameObject;
     isEnemy = true;
     spriterender = GetComponent<Renderer>() as SpriteRenderer;
     player = GameObject.FindGameObjectWithTag("Player");
 }
开发者ID:charblaze,项目名称:SoulSynthus,代码行数:8,代码来源:SeaMonsterSlam.cs


示例15: Start

    // Use this for initialization
    void Start () {
        sprite = GetComponent<SpriteRenderer>();
        scr_ObjectFactory = GameObject.FindGameObjectWithTag("ObjectFactory").GetComponent<objectFactory>();
        collidingManList = new List<GameObject>();
        fallDirection = new Vector3(0, -fallSpeed, 0);

    }
开发者ID:JRSerjeant,项目名称:GGJ2016,代码行数:8,代码来源:scr_ground.cs


示例16: Start

 // Use this for initialization
 void Start()
 {
     orbitPathSpriteRenderer = this.gameObject.GetComponent<SpriteRenderer>();
     //Last value is alpha value
     orbitPathSpriteRenderer.color = new Color(1f, 1f, 1f, visiblePercent);
     getPlanetGo ();
 }
开发者ID:Battlespud,项目名称:ducking-octo-shame,代码行数:8,代码来源:OrbitAlphaController.cs


示例17: Start

	// Use this for initialization
	void Start () {
        notBroken = false;
        health = 0;
        numBroke = 0;
        Srenderer = GetComponent<SpriteRenderer>();
        Srenderer.color = colors[0];
    }
开发者ID:zrcoutur,项目名称:topdown,代码行数:8,代码来源:Turret.cs


示例18: Start

 void Start()
 {
     target = GameObject.FindGameObjectWithTag("Player");
     m_spriteRenderer = GetComponent<SpriteRenderer>();
     m_playerStats = target.GetComponent<Stats> ();
     m_life = m_playerStats.m_life;
 }
开发者ID:noctisyounis,项目名称:Playground2015_Project1,代码行数:7,代码来源:LifeBar.cs


示例19: Init

    public virtual void Init(Grid grid, int x, int y, float scale = 1, Sprite asset = null)
    {
        sfx = AudioManager.instance;

        container = transform.Find("Sprites");
        outline = transform.Find("Sprites/Outline").GetComponent<SpriteRenderer>();
        img = transform.Find("Sprites/Sprite").GetComponent<SpriteRenderer>();
        shadow = transform.Find("Sprites/Shadow").GetComponent<SpriteRenderer>();
        shadow.gameObject.SetActive(false);

        label = transform.Find("Label").GetComponent<TextMesh>();
        label.GetComponent<Renderer>().sortingLayerName = "Ui";
        label.gameObject.SetActive(Debug.isDebugBuild);

        this.grid = grid;
        this.x = x;
        this.y = y;
        this.asset = asset;

        this.walkable = true;

        transform.localPosition = new Vector3(x, y, 0);

        SetAsset(asset);
        SetImages(scale, Vector3.zero, 0);
        SetSortingOrder(0);

        visible = false;
        explored = false;
    }
开发者ID:snaptothegrid,项目名称:Tiler,代码行数:30,代码来源:Tile.cs


示例20: Start

	// Use this for initialization
	void Start () {
        rb = GetComponent<Rigidbody2D>();
        sr = GetComponent<SpriteRenderer>();
        limits = Camera.main.ViewportToWorldPoint(Vector3.right).x -
            HalfWidth;
        time = shootTime;
    }
开发者ID:santii810,项目名称:Dam209,代码行数:8,代码来源:Player.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SpriteRoot类代码示例发布时间:2022-05-24
下一篇:
C# SpriteFont类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap