本文整理汇总了C#中tk2dSprite类的典型用法代码示例。如果您正苦于以下问题:C# tk2dSprite类的具体用法?C# tk2dSprite怎么用?C# tk2dSprite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
tk2dSprite类属于命名空间,在下文中一共展示了tk2dSprite类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
Sprite = GetComponent<tk2dSprite>();
StartColor = GetComponent<tk2dSprite>().color;
StartCoroutine(FadeHole(FadeTime));
}
示例2: Start
void Start()
{
toggleHealthButton = GameObject.Find("HealthBarToggleButton").GetComponent<UIButton>();
healthButton = GameObject.Find("HealthBarToggleButton").GetComponent<tk2dSprite>();
SetButton();
}
示例3: Start
// Use this for initialization
void Start ()
{
if (viewCamera == null)
viewCamera = GameObject.Find("GUIBoxCamera").GetComponent<Camera>();
sprite = GetComponent<tk2dSprite>();
// Change this to use animated sprites if necessary
// Same concept here, lookup Ids and call Play(xxx) instead of .spriteId = xxx
buttonDownSpriteId = sprite.GetSpriteIdByName(buttonDownSprite);
buttonUpSpriteId = sprite.GetSpriteIdByName(buttonUpSprite);
buttonPressedSpriteId = sprite.GetSpriteIdByName(buttonPressedSprite);
if (collider == null)
{
BoxCollider newCollider = gameObject.AddComponent<BoxCollider>();
Vector3 colliderExtents = newCollider.extents;
colliderExtents.z = 0.2f;
newCollider.extents = colliderExtents;
}
monsterSprite = transform.FindChild("MonsterImage").GetComponent<tk2dSprite>();
monsterSprite.enabled = false;
LoadMonster();
StartCoroutine(coHandleMouseEnter());
}
示例4: DoTransparency
public static IEnumerator DoTransparency(tk2dSprite[] sprite, float time, CallBackPtr callbackPtr = null){
Color orinColor = new Color(1, 1, 1, 0);//sprite.color;
Color targetColor = new Color(1, 1, 1, 1);
Color curSrcColor;
Color curTargetColor;
int reverseCount = 16 * (int)time;
for(int i = 0; i < reverseCount; i++){
if((i & 1) == 0){
curSrcColor = new Color(orinColor.r, orinColor.g, orinColor.b, orinColor.a);
curTargetColor = new Color(targetColor.r, targetColor.g, targetColor.b, targetColor.a);
}
else{
curSrcColor = new Color(targetColor.r, targetColor.g, targetColor.b, targetColor.a);
curTargetColor = new Color(orinColor.r, orinColor.g, orinColor.b, orinColor.a);
}
for(float t = 0; t < time / reverseCount; t += tk2dUITime.deltaTime){
float nt = Mathf.Clamp01( t / (time / reverseCount) );
nt = Mathf.Sin(nt * Mathf.PI * 0.5f);
for(int j = 0; j < sprite.Length; j++)
sprite[j].color = Color.Lerp(curSrcColor, curTargetColor, nt);
yield return 0;
}
}
for(int j = 0; j < sprite.Length; j++)
sprite[j].color = targetColor;//Color.Lerp(curSrcColor, curTargetColor, nt);
if(callbackPtr != null)
callbackPtr();
}
示例5: Start
void Start()
{
sprite = GetComponent<tk2dSprite>();
player = GameObject.FindGameObjectWithTag("Player");
OldX = transform.position.x;
OldY = transform.position.y;
}
示例6: Start
void Start()
{
mState1 = State1.ScaleUp;
mState2_IsFadingOut = false;
mShakeDirects = new Vector3[]{
new Vector3(-1F,1F,0F)
,new Vector3(1F,-1.2F,0F)
,new Vector3(1.2F,1F,0F)
,new Vector3(-1.2F,-0.8F,0F)
};
mSprWeb = Pool_GameObj.GetObj(Prefab_GoSpriteWeb).GetComponent<tk2dSprite>();
if (NameSprite != null && NameSprite != "")
mSprWeb.spriteId = mSprWeb.GetSpriteIdByName(NameSprite);
Transform ts = mSprWeb.transform;
mSprWeb.gameObject.SetActive(true);
ts.parent = transform;
ts.localPosition = Vector3.zero;
Color c = ColorInitialize;
c.a = 1F;
mSprWeb.color = c;
mTsWeb = ts;
mTimeWaitFadeout = TimeWebScaleUp + TimeShake - TimeFadeOut;
mColorWeb = mSprWeb.color;
}
示例7: _Coro_BubbleScaleUp
IEnumerator _Coro_BubbleScaleUp(tk2dSprite spr)
{
//������ɫ
Color c = spr.color;
c.a = AlphaStart;
spr.color = c;
float elapse = 0F;
//�Ŵ�
Transform tsSpr = spr.transform;
float scaleUpTime = TimeOneBubble * 0.7F;
while (elapse < scaleUpTime)
{
tsSpr.localScale = (ScaleTarget * (0.5F + elapse / scaleUpTime * 0.5F)) * Vector3.one;
elapse += Time.deltaTime;
yield return 0F;
}
tsSpr.localScale = Vector3.one * ScaleTarget;
//����
elapse = 0F;
float fadeoutTime = TimeOneBubble * 0.3F;
while (elapse < fadeoutTime)
{
c.a = (1F - elapse / fadeoutTime) * AlphaStart;
spr.color = c;
elapse += Time.deltaTime;
yield return 0F;
}
//ɾ��
spr.gameObject.SetActive(false);
Pool_GameObj.RecycleGO(Prefab_Bubble.gameObject, spr.gameObject);
//Destroy(spr.gameObject);
}
示例8: Awake
void Awake() {
sprite = GetComponent<tk2dSprite>();
if (textMesh == null || textMesh.transform.parent != transform) {
Debug.LogError("Text mesh must be assigned and parented to player.");
enabled = false;
}
textMeshOffset = textMesh.transform.position - transform.position;
textMesh.transform.parent = null;
textMeshLabel.text = "instructions";
textMeshLabel.Commit();
if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsWebPlayer ||
Application.platform == RuntimePlatform.OSXEditor || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXWebPlayer || Application.platform == RuntimePlatform.OSXDashboardPlayer) {
textMesh.text = "LEFT ARROW / RIGHT ARROW";
}
else {
textMesh.text = "TAP LEFT / RIGHT SIDE OF SCREEN";
}
textMesh.Commit();
Application.targetFrameRate = 60;
}
示例9: UpdateSelectedInfo
public void UpdateSelectedInfo()
{
this.bgSprite = base.GetComponent<tk2dSprite>();
this.button = base.GetComponent<tk2dButton>();
if (this.isSelected)
{
this.button.enabled = false;
this.button.StopAllCoroutines();
this.button.buttonDown = false;
this.bgSprite.SetSprite(this.selectedSpriteName);
Vector3 localPosition = this.bgSprite.transform.localPosition;
localPosition.y = this.selectedPositionY;
this.bgSprite.transform.localPosition = localPosition;
}
else
{
this.button.enabled = true;
this.button.StopAllCoroutines();
this.button.buttonDown = false;
this.bgSprite.SetSprite(this.normalSpriteName);
Vector3 vector2 = this.bgSprite.transform.localPosition;
vector2.y = this.normalPositionY;
this.bgSprite.transform.localPosition = vector2;
}
}
示例10: configureObject
public void configureObject(tk2dSprite sprite, string resGroup, string spriteName)
{
if (!_spriteCollections.ContainsKey(resGroup))
loadSpriteCollection(resGroup);
sprite.SwitchCollectionAndSprite(_spriteCollections[resGroup].spriteCollection, _spriteCollections[resGroup].spriteCollection.GetSpriteIdByName(spriteName));
}
示例11: Start
// Use this for initialization
void Start()
{
anim = GetComponent<tk2dSpriteAnimator>();
anim.Play("walking");
distToGround = collider.bounds.extents.y;
gravityTotal = gravity;
sprite = GetComponent<tk2dSprite>();
}
示例12: Start
// Use this for initialization
void Start()
{
player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
actionText = this.transform.FindChild("Action Text").GetComponent<tk2dTextMesh>();
actionButton = this.transform.FindChild("Action Button").GetComponent<tk2dSprite>();
timeLeftUntilFade = maxTimeUntilFade;
}
示例13: Start
void Start()
{
sprite = GetComponent<tk2dSprite>();
//healthText = FindChild(gameObject.name, "HealthText").GetComponent<tk2dTextMesh>();
health = startHealth;
isAlive = true;
}
示例14: Awake
// Use this for initialization
void Awake()
{
timer = this.GetComponent<Timer> ();
audioSource = this.GetComponent<AudioSource> ();
timer.Init ();
timer.AddEvent(new Timer.TimerEvent(this.ScaleSprite, secondsBetweenPlayAndScale, true));
sprite = this.GetComponent<tk2dSprite> ();
}
示例15: Start
private void Start()
{
if (this.sprite == null)
{
this.sprite = base.GetComponent<tk2dSprite>();
}
this.SetIcon();
}