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


C# OTSprite.InitCallBacks方法代码示例

本文整理汇总了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
    }
开发者ID:raikruz,项目名称:6Abandoned,代码行数:45,代码来源:Cow.cs

示例2: Start

 void Start()
 {
     sprite = GetComponent<OTSprite>();
     sprite.InitCallBacks(this);
 }
开发者ID:raikruz,项目名称:6Abandoned,代码行数:5,代码来源:Boat.cs


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