• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# OTObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



OTObject类属于命名空间,在下文中一共展示了OTObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnCollision

 // This method will be called when this block is hit.
 
 public void OnCollision(OTObject owner)
 {
     // Set color fading indicator
     colorFade = true;
     // Reset fade time
     fadeTime = 0;
 }
开发者ID:Kingpin0509,项目名称:CardioWars,代码行数:9,代码来源:CBlock2.cs


示例2: SizerDrag

 void SizerDrag(OTObject owner)
 {
     Vector2 s = sizer.position - window.position;
     window.size = new Vector2(s.x-12,(-s.y)+10);
     (window as OTScale9Sprite).Rebuild();
     text.wordWrap = (int)(window.size.x/text.size.x)-100;
 }
开发者ID:borderpointer,项目名称:zhoras-adventure,代码行数:7,代码来源:OTTextChalc.cs


示例3: Dragging

	void Dragging(OTObject owner)
	{
		GameObject.Find("Dragging").GetComponent<Renderer>().enabled = true;		
		GameObject.Find("Dragging").GetComponent<TextMesh>().text = 
			"Dragging "+owner.name+" at "+((OT.mobile?""+sprite.dragTouch.position:""+Input.mousePosition))+" -- "+OTDragObject.dragObjects.Count;
						
	}
开发者ID:pablovin,项目名称:cordel,代码行数:7,代码来源:DragTest.cs


示例4: OnCollision

    public void OnCollision(OTObject owner)
    {
        if(areaOfEffect > 0 && (owner.gameObject.layer != gameObject.layer)) {

            Collider[] allUnitsCollided = null;
            if(gameObject.layer == 8) {
                allUnitsCollided = Physics.OverlapSphere(myTransform.position, areaOfEffect, 1 << 9);
            }
            if(gameObject.layer == 9) {
                allUnitsCollided = Physics.OverlapSphere(myTransform.position, areaOfEffect, 1 << 8);
            }
            if(allUnitsCollided != null) {
                foreach(Collider c in allUnitsCollided) {
                    Unit u = c.gameObject.GetComponent<Unit>();
                    if(u) u.dealDamage(damage);
                    //c.gameObject.GetComponent<Unit>().dealDamage(damage);
                }
            }
            if(gameObject != null) DestroyObject(gameObject);
        } else {
            Unit collisionTarget = owner.collisionObject.gameObject.GetComponent<Unit>();

            if(collisionTarget != null) {
                if((gameObject.layer == 8 && collisionTarget.getLayer() == 9) || (gameObject.layer == 9 && collisionTarget.getLayer() == 8)) {
                    //collisionTarget.HP -= damage;
                    collisionTarget.dealDamage(damage);
                    if(gameObject != null)
                        DestroyObject(gameObject);
                        //OT.DestroyObject(gameObject);
                }
            }
        }
    }
开发者ID:cmapua,项目名称:Mythos-High,代码行数:33,代码来源:Projectile.cs


示例5: SetParameters

    public void SetParameters(OTObject shooter, Vector2 velocity, float range, 
		float damage, OTObject target, List<Effect> effects)
    {
        _target = target;
        _effects = effects;
        SetParameters(shooter, velocity, range, damage);
    }
开发者ID:rtm907,项目名称:C--Unity-Game-Exercise,代码行数:7,代码来源:arrowManager.cs


示例6: HandleHit

    private void HandleHit(OTObject owner)
    {
        //Get a hold of this enemy ship's data and adjust it
        EnemyShip enemy = owner.collisionObject.GetComponent<EnemyShip>();

        //Handle harvest missiles
        if (isHarvester)
        {
            //TODO: Add consideration for armor
            if (enemy.health <= damage) //it's going to be a killing blow
                gameState.playerScore += (int)(enemy.resourceReward*harvestPercentage);
            enemy.health -= damage;
            //Remove this projectile
            OT.DestroyObject(sprite);
        }
        //Handle smart missiles
        else if (isSmart)
        {
            //Check to see if the enemy is our target
            if (owner.collisionObject.Equals(target))
            {
                enemy.health -= damage;
                //Remove this projectile
                OT.DestroyObject(sprite);
            }
            //not our target? Ignore collision
        }
        else //normal missile, just deal damage and remove the sprite
        {
            enemy.health -= damage;
            //Remove this projectile
            OT.DestroyObject(sprite);
        }
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:34,代码来源:PlayerMissile.cs


示例7: Dragging

	void Dragging(OTObject owner)
	{
		GameObject.Find("Dragging").renderer.enabled = true;		
		GameObject.Find("Dragging").GetComponent<TextMesh>().text = 
			"Dragging at touch position "+((OT.mobile?""+sprite.dragTouch.position:""+Input.mousePosition));
						
	}
开发者ID:pravusjif,项目名称:PravusUnityTests,代码行数:7,代码来源:DragTest.cs


示例8: DragEnd

    void DragEnd(OTObject owner)
    {
        GameObject.Find("DragEnd").renderer.enabled = true;

        if (main.onlyOnPurple)
        {
            if (owner.dropTarget==null || owner.dropTarget.name!="draggable sprite purple")
            {
                // invalidate this drop by setting target to null
                owner.dropTarget = null;
                return;
            }
        }

        if (owner.dropTarget!=null)
        {
            GameObject.Find("DragEnd").GetComponent<TextMesh>().text =
                "Drag Ended - dropped on "+owner.dropTarget.name;
        }
        else
            GameObject.Find("DragEnd").GetComponent<TextMesh>().text =
                "Drag Ended";

        OTDebug.Message(GameObject.Find("DragEnd").GetComponent<TextMesh>().text);

        ended = true;
    }
开发者ID:borderpointer,项目名称:zhoras-adventure,代码行数:27,代码来源:DragTest.cs


示例9: OnCollision

    void OnCollision(OTObject owner)
    {
        //Cambia la direccion de la velocidad segun en que borde rebota la bola.

        if (owner.collisionObject.name.IndexOf("TopBorder") == 0 && speed.y>0){
            speed.y*=-1;
            if ((speed.x < 0 && rotationSpeed > 0) || (speed.x > 0 && rotationSpeed < 0))
                rotationSpeed *= -1;
        }
        else
            if (owner.collisionObject.name.IndexOf("BottomBorder") == 0 && speed.y < 0)
            {
                speed.y *= -1;
                if ((speed.x < 0 && rotationSpeed < 0) || (speed.x > 0 && rotationSpeed > 0))
                    rotationSpeed *= -1;
            }
            else
                if (owner.collisionObject.name.IndexOf("LeftBorder") == 0 && speed.x < 0)
                {
                    speed.x *= -1;
                    if ((speed.y < 0 && rotationSpeed > 0) || (speed.y > 0 && rotationSpeed < 0))
                        rotationSpeed *= -1;
                }
                else
                    if (owner.collisionObject.name.IndexOf("RightBorder") == 0 && speed.x > 0)
                    {
                        speed.x *= -1;
                        if ((speed.y < 0 && rotationSpeed < 0) || (speed.y > 0 && rotationSpeed > 0))
                            rotationSpeed *= -1;
                    }
    }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:31,代码来源:Ball.cs


示例10: Explode

    bool initialized = false; // initialization notifier

    #endregion Fields

    #region Methods

    // This method will explode an asteroid
    public void Explode(OTObject o, CBullet3 bullet)
    {
        // Determine how many debree has to be be created
        int blocks = 2 + (int)Mathf.Floor(Random.value * 2);
        // Create debree
        for (int b = 0; b < blocks; b++)
        {
            // Shrink asteroid's rect to act as the random position container
            // for the debree
            Rect r = new Rect(
                o.rect.x + o.rect.width / 4,
                o.rect.y + o.rect.height / 4,
                o.rect.width / 2,
                o.rect.height / 2);
            // Create a debree that is relatively smaller than the asteroid that was detroyed
            OTAnimatingSprite a = RandomBlock(r, 0.6f, 0.75f, o);

            // Add this debree to the bullet telling the bullet to ignore this debree
            // in this update cycle - otherwise the bullet explosions could enter some
            // recursive 'dead' loop creating LOTS of debree
            bullet.AddDebree(a);
            // Recusively explode 2 asteroids if they are big enough, to get a nice
            // exploding debree effect.
            if (b < 2 && a.size.x > 30)
                Explode(a, bullet);
        }
        // Notify that this asteroid has to be destroyed
        OT.DestroyObject(o);
    }
开发者ID:cmapua,项目名称:Mythos-High,代码行数:36,代码来源:CExample3.cs


示例11: OnCollision

 // OnCollision delegate is called when star collides with another 'collidable' object
 // HINT - OnEnter and OnCollision delegates are called exactly at the same time, the only
 // difference is their naming convention
 
 public void OnCollision(OTObject owner)
 {
     // check if we collided with a top block and adjust our speed and rotation accordingly
     if (owner.collisionObject.name.IndexOf("top") == 0 && speed.y > 0)
     {
         speed = new Vector2(speed.x, speed.y * -1);
         if ((speed.x < 0 && rotation > 0) || (speed.x > 0 && rotation < 0))
             rotation *= -1;
     }
     else
         // check if we collided with a bottom block and adjust our speed and rotation accordingly
         if (owner.collisionObject.name.IndexOf("bottom") == 0 && speed.y < 0)
         {
             speed = new Vector2(speed.x, speed.y * -1);
             if ((speed.x < 0 && rotation < 0) || (speed.x > 0 && rotation > 0))
                 rotation *= -1;
         }
         else
             // check if we collided with a left block and adjust our speed and rotation accordingly
             if (owner.collisionObject.name.IndexOf("left") == 0 && speed.x < 0)
             {
                 speed = new Vector2(speed.x * -1, speed.y);
                 if ((speed.y < 0 && rotation > 0) || (speed.y > 0 && rotation < 0))
                     rotation *= -1;
             }
             else
                 // check if we collided with a right block and adjust our speed and rotation accordingly
                 if (owner.collisionObject.name.IndexOf("right") == 0 && speed.x > 0)
                 {
                     speed = new Vector2(speed.x * -1, speed.y);
                     if ((speed.y < 0 && rotation < 0) || (speed.y > 0 && rotation > 0))
                         rotation *= -1;
                 }
 }
开发者ID:pablovin,项目名称:cordel,代码行数:38,代码来源:CStar2.cs


示例12: OnCollided

    public void OnCollided(OTObject owner)
    {
        OTObject obj = owner.collisionObject;
        if(Chick_die == false && (obj.name == "Boat0" || obj.name == "Boat1"))
        {
            // make sure the animal is ON the boat
            if((chick.position.x-chick.size.x/2)< (obj.position.x-obj.size.x/2))
                chick.position = new Vector2(obj.position.x-obj.size.x/2+ chick.size.x/2,chick.position.y);
            else if((chick.position.x+chick.size.x/2)> (obj.position.x+obj.size.x/2))//-0.25*obj.size.x is a tolerance
                chick.position = new Vector2(obj.position.x+obj.size.x/2- chick.size.x/2-0.25f*obj.size.x,chick.position.y);

            landBoat = owner.collisionObject;
            landBoatPosX = landBoat.position.x;
            chick.frameIndex = 0;
            chick.rigidbody.velocity = new Vector3(0, 0, 0);
            chick.collidable = false; // no need enter OnCollided any more

            Main.animalSaved++;
            Main.decreaseAnimal(0);

        } else if(Chick_die == false && landBoat == null
                && (obj.name.StartsWith("BackGround_Bottom")  ||  obj.name.StartsWith("Bee_left")
            ||obj.name.StartsWith("Bee_right") ||obj.name.StartsWith("Maneater_plant")))
        {
            died.Play();
            deadTime = Time.time;
            // show the chick dead left object
            chick.frameIndex = 2;
            // set the die flag
            Chick_die = true;
            chick.collidable = false; // no need enter OnCollided any more
        }
    }
开发者ID:raikruz,项目名称:6Abandoned,代码行数:33,代码来源:Chick.cs


示例13: HandleHit

    private void HandleHit(OTObject owner)
    {
        //Get a hold of this enemy ship's data and adjust it
        EnemyShip enemy = owner.collisionObject.GetComponent<EnemyShip>();
        enemy.health -= damage;
        //Handle flak projectiles
        if (isFlak)
        {
            //make an explosion of slugs generate 5 slugs that fly in random directions... OLD BEHAVIOUR
            /*
            for (int i = 0; i < 5; i++)
            {
                GameObject bullet = OT.CreateObject("PlayerCannonProjectile");
                myProjectile = bullet.GetComponent<OTSprite>();
                myProjectile.renderer.enabled = true;

                // fire in a random direction
                Vector2 target = new Vector2(Random.value*100-50,Random.value*100-50);
                myProjectile.position = sprite.position;
                myProjectile.RotateTowards(target);

                //Assign the projectile its atributes.
                PlayerCannonProjectile pcp = (PlayerCannonProjectile)myProjectile.GetComponent(typeof(PlayerCannonProjectile));
                pcp.damage = damage;
                pcp.speed = speed;
                pcp.isFlak = false;
            }
            */
            //Now we do nothing special here
        }
        //Handle super flaks
        if (isSuperFlak)
        {
            /*
            //make an explosion of slugs generate 5 slugs that fly in random directions
            for (int i = 0; i < 5; i++)
            {
                GameObject bullet = OT.CreateObject("PlayerCannonProjectile");
                myProjectile = bullet.GetComponent<OTSprite>();
                myProjectile.renderer.enabled = true;

                // fire in a random direction
                Vector2 target = new Vector2(Random.value*100-50,Random.value*100-50);
                myProjectile.position = sprite.position;
                myProjectile.RotateTowards(target);

                //Assign the projectile its atributes.
                PlayerCannonProjectile pcp = (PlayerCannonProjectile)myProjectile.GetComponent(typeof(PlayerCannonProjectile));
                pcp.damage = damage;
                pcp.speed = speed;
                pcp.isFlak = true;
                pcp.isSuperFlak = false;
            }
            */
            // Now we do nothing special here
        }
        //Remove this projectile
        OT.DestroyObject(sprite);
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:59,代码来源:PlayerCannonProjectile.cs


示例14: OnCollision

 public void OnCollision(OTObject owner)
 {
     //Check to see if the collision is with an enemy ship
     if (owner.collisionObject.name.ToLower().Contains("enemyship"))
     {
         HandleHit(owner);
     }
 }
开发者ID:dreamlane,项目名称:Brokion,代码行数:8,代码来源:PlayerBeam.cs


示例15: HandleHitWorld

 private void HandleHitWorld(OTObject owner)
 {
     //Get a hold of the city data and adjust it
     //TODO implement damage reduction appropriately
     World world = owner.collisionObject.GetComponent<World>();
     world.health -= damage;
     //Remove this projectile
     OT.DestroyObject(sprite);
 }
开发者ID:dreamlane,项目名称:Brokion,代码行数:9,代码来源:EnemyBeam.cs


示例16: OnAnimationFinish

 // The OnAnimationFinish delegate will be called when an animation or animation frameset
 // finishes playing.
 public void OnAnimationFinish(OTObject owner)
 {
     if (owner == gun)
     {
         // Because the only animation that finishes will be the gun's 'shoot' animation frameset
         // we know that we have to switch to the gun's looping 'idle' animation frameset
         gun.PlayLoop("idle");
     }
 }
开发者ID:cmapua,项目名称:Mythos-High,代码行数:11,代码来源:CExample3.cs


示例17: OnAnimationFinished

 public void OnAnimationFinished(OTObject owner)
 {
     if (MySprite.animationFrameset == "ai") {
         MySprite.looping = true;
         MySprite.animationFrameset = "run";
         Debug.Log ("1");
         MySprite.Play ();
     }
 }
开发者ID:vladimirtemnikov,项目名称:2D_Platformer_SteamPunk,代码行数:9,代码来源:Move.cs


示例18: SetParemeters

    public void SetParemeters(OTObject shooter, float damage)
    {
        _AOE = GetComponent<OTAnimatingSprite>();
        _AOE.onCollision = OnCollision;
        _shooter = shooter;
        _damage = damage;

        _AOE.transform.parent = AOEContainer.transform;
    }
开发者ID:rtm907,项目名称:C--Unity-Game-Exercise,代码行数:9,代码来源:AOEManager.cs


示例19: OnCollision

 public void OnCollision(OTObject owner)
 {
     //Check to see if the collision is with an enemy ship
     if (owner.collisionObject.name.Equals("City"))
         HandleHitCity(owner);
     if (owner.collisionObject.name.Contains("World"))
         HandleHitWorld(owner);
     if (owner.collisionObject.name.Equals("CityShield"))
         HandleHitCityShield(owner);
 }
开发者ID:dreamlane,项目名称:Brokion,代码行数:10,代码来源:EnemyBeam.cs


示例20: DragStart

    void DragStart(OTObject owner)
    {
        GameObject.Find("DragStart").renderer.enabled = true;
        GameObject.Find("Dragging").renderer.enabled = false;
        GameObject.Find("DragEnd").renderer.enabled = false;
        ended = false;
        endTimer = 0;

        OTDebug.Message("start dragging "+owner.name);
    }
开发者ID:namofni,项目名称:Lode-Tutorial,代码行数:10,代码来源:DragTest.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# OTSprite类代码示例发布时间:2022-05-24
下一篇:
C# OTContainer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap