本文整理汇总了C#中OTSprite.InitCallBacks方法的典型用法代码示例。如果您正苦于以下问题:C# OTSprite.InitCallBacks方法的具体用法?C# OTSprite.InitCallBacks怎么用?C# OTSprite.InitCallBacks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTSprite
的用法示例。
在下文中一共展示了OTSprite.InitCallBacks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
landBoat = null;
landBoatPosX = 0f;
// Get this cow's sprite
cow = GetComponent<OTSprite>();
cow.InitCallBacks(this);
cow.onInput = OnInput;
cow.onEnter = OnCollided;
cow.frameIndex = 1;
// initialize variables
// initialize the velocity and start position
cow.rigidbody.isKinematic = false;
// initialize the velocity as 25 in -y direction
cow.rigidbody.velocity = new Vector3(0, -50,0);
cow.size = new Vector2(Screen.width *0.255f, Screen.width *0.255f*1.333f);
float randomValue1 = Random.value;
// here 3*Cow.size.y is to give the gap on left and right. Please increase it to decrease difficulty,
// because it will minimize the falling range on the sky
// start position x should be random
var creationScreenwidth = Screen.width - 3*cow.size.y;
startPos.x = creationScreenwidth*(randomValue1 - 0.5f);
startPos.y = Screen.height/2;
startPos.z = 0;
cow.position = new Vector2(startPos.x , startPos.y);
// give random initilial direction (left or right)
float randomValue2 = Random.value;
if(randomValue2 < 0.5f)
k = startPos.y*0.015f-(3.1415926f/2f);
else
k = startPos.y*0.015f+(3.1415926f/2f);
bWindAffected = false;
tWind = 0;
deadTime = 0f;
dragstep = Screen.height * 0.05f;
AudioSource[] aSources = GetComponents<AudioSource>();
sound = aSources[0];//Drag sound
died = aSources[1]; //dead sound
}
示例2: Start
void Start()
{
sprite = GetComponent<OTSprite>();
sprite.InitCallBacks(this);
}