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


C# SpriteRenderer类代码示例

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


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


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