本文整理汇总了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);
}
示例2: Start
protected virtual void Start()
{
decayLevel = 0;
maxDecayLevel = DecayStates.Length;
spriteRenderer = GetComponent<SpriteRenderer>();
boxCollider = GetComponent<BoxCollider2D>();
}
示例3: Start
// Use this for initialization
void Start ()
{
currentHealth = maxHealth;
currentInvincibilityTime = maxInvincibilityTime;
rend = GetComponent<SpriteRenderer> ();
Time.timeScale = 1;
}
示例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>();
}
示例5: Start
void Start ()
{
if (messageObject == null) {
messageObject = gameObject;
}
spriteRendererComp = GetComponent<SpriteRenderer> ();
}
示例6: Awake
void Awake()
{
sprite = GetComponent<SpriteRenderer>();
body = GetComponent<Rigidbody2D>();
col = GetComponent<BoxCollider2D>();
parentBalista = transform.parent.gameObject;
}
示例7: init
public void init () {
// trans = transform;
// newPos = trans.localPosition;
// initX = newPos.x;
// maxX = initX + .16f;
render = GetComponent<SpriteRenderer>();
}
示例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;
}
}
示例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>();
}
示例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);
}
示例11: Start
void Start()
{
base.Start();
controller = GetComponent<Controller2D>();
spriteRenderer = GetComponent<SpriteRenderer>();
enemySpeed = -enemySpeed;
}
示例12: Start
void Start()
{
_spriteRenderer = GetComponent<SpriteRenderer>();
_boxCollider = GetComponent<BoxCollider2D>();
_isLaserVisible = isLaserVisibleOnStart;
ChangeLaserApperance ();
}
示例13: Start
//public GameObject box;
void Start()
{
this.GetComponent<Collider2D>().enabled = false;
Sr = this.GetComponent<SpriteRenderer>();
this.layer = Sr.sortingOrder;
top = GeneralAttrib.maxi;
}
示例14: Start
// Use this for initialization
void Start()
{
caster = gameObject;
isEnemy = true;
spriterender = GetComponent<Renderer>() as SpriteRenderer;
player = GameObject.FindGameObjectWithTag("Player");
}
示例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);
}