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

C# OTSprite类代码示例

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

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



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

示例1: Start

    // Use this for initialization
    void Start()
    {
        placement1 = GameObject.Find("Placement1").GetComponent<OTSprite>();
        placement2 = GameObject.Find("Placement2").GetComponent<OTSprite>();
        placement3 = GameObject.Find("Placement3").GetComponent<OTSprite>();
        placement4 = GameObject.Find("Placement4").GetComponent<OTSprite>();
        placement5 = GameObject.Find("Placement5").GetComponent<OTSprite>();
        placement6 = GameObject.Find("Placement6").GetComponent<OTSprite>();
        city = GameObject.Find("City").GetComponent<OTSprite>();

        allTargets.Add(placement1);
        allTargets.Add(placement2);
        allTargets.Add(placement3);
        allTargets.Add(placement4);
        allTargets.Add(placement5);
        allTargets.Add(placement6);
        allTargets.Add(city);

        noCity.Add(placement1);
        noCity.Add(placement2);
        noCity.Add(placement3);
        noCity.Add(placement4);
        noCity.Add(placement5);
        noCity.Add(placement6);
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:26,代码来源:Targets.cs


示例2: Start

 // Use this for initialization
 void Start()
 {
     damage = 10;
     sprite = GetComponent<OTSprite>();
     sprite.onCollision = OnCollision;
     flightTime = 0.0f;
 }
开发者ID:dreamlane,项目名称:Brokion,代码行数:8,代码来源:PlayerBeam.cs


示例3: DeregisterGoon

 public void DeregisterGoon(OTSprite goon)
 {
     if(_mob.Contains(goon))
     {
         _mob.Remove(goon);
     }
 }
开发者ID:rtm907,项目名称:C--Unity-Game-Exercise,代码行数:7,代码来源:MobManager.cs


示例4: Attack

    void Attack()
    {
        //Determine if firing by picking a random number
        if (Random.Range(0,101) <= shotCoefficient)
        {
            //This ship shoots 5 slugs almost at once, so set the shot coefficient to 100 to garauntee that
            shotCoefficient = 100;
            //Generate a projectile
            GameObject bullet = OT.CreateObject("EnemyProjectile");
            myProjectile = bullet.GetComponent<OTSprite>();
            myProjectile.renderer.enabled = true;

            // Pick a random target, and fire at it
            // TODO add target picking code
            float targetX = Random.value*90.0f-45.0f;
            Vector2 target = new Vector2(targetX,-40.0f);
            myProjectile.position = sprite.position;
            myProjectile.RotateTowards(target);

            //Assign the projectile its atributes.
            EnemyProjectile ep = (EnemyProjectile)myProjectile.GetComponent(typeof(EnemyProjectile));
            ep.speed = projectileSpeed;
            ep.damage = projectileDamage;
            ep.attackType = attackType;

            shotCount++;
            if (shotCount > 5)
            {
                shotCount = 1;
                shotAvailable = false;
                timeSinceLastShot = 0.0f;
                shotCoefficient = 5;
            }
        }
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:35,代码来源:Frigate.cs


示例5: Attack

    void Attack()
    {
        timeSinceLastShot = 0.0f;
        //fire a player projectile towards an enemy ship
        GameObject bullet = OT.CreateObject("PlayerCannonProjectile");
        myProjectile = bullet.GetComponent<OTSprite>();
        myProjectile.renderer.enabled = true;

        // Pick a target, and fire at it
        Vector2 target = Targets.PickRandomEnemyTarget().position;
        //We don't want the slugs to be very accurate, so offset the x and y by between (-2,2)
        float offsetX = Random.value*4.0f-2.0f;
        float offsetY = Random.value*4.0f-2.0f;
        target = new Vector2(target.x+offsetX,target.y+offsetY);
        myProjectile.position = sprite.position;
        myProjectile.RotateTowards(target);

        //Assign the projectile its atributes.
        PlayerCannonProjectile pcp = (PlayerCannonProjectile)myProjectile.GetComponent(typeof(PlayerCannonProjectile));
        pcp.damage = damage;
        pcp.speed = projectileSpeed;
        pcp.isFlak = false;
        pcp.target = target;
        pcp.isFlakShell = false;
        pcp.isSuperFlak = true;
        pcp.shellFlightTime = 0.5f;
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:27,代码来源:SuperFlakCannon.cs


示例6: Setup

    public void Setup(LevelManager _lev)
    {
        _spr = FETool.findWithinChildren(gameObject, "TheGate").GetComponentInChildren<OTSprite>();
        _levMan = _lev;
        GameEventManager.Respawn += Respawn;
        GameEventManager.GameOver += GameOver;

        firstStep = FETool.findWithinChildren(gameObject, "ExitLoc/1");
        secondStep = FETool.findWithinChildren(gameObject, "ExitLoc/2");
        thirdStep = FETool.findWithinChildren(gameObject, "ExitLoc/3");

        spriteFirstStep = firstStep.GetComponentsInChildren<OTSprite>();
        spriteSecondStep = secondStep.GetComponentsInChildren<OTSprite>();
        spriteThirdStep = thirdStep.GetComponentsInChildren<OTSprite>();

        fadeSprites(spriteFirstStep, 0f);
        fadeSprites(spriteSecondStep, 0f);
        fadeSprites(spriteThirdStep, 0f);

        for (int i = 0 ; i < 24 ; i++)
        {
            slotList.Add(FETool.findWithinChildren(gameObject, "Slots/" + (i+1).ToString()));
        }
        defaultSlot = FETool.findWithinChildren(gameObject, "Slots/Default");

        Vortex = FETool.findWithinChildren(gameObject, "Vortex").GetComponentInChildren<OTAnimatingSprite>();
    }
开发者ID:Tavrox,项目名称:Lavapools,代码行数:27,代码来源:SpaceGate.cs


示例7: SpawnBattleship

    private float timeSinceLastSpawn; //time since the last ship was spawned in seconds

    #endregion Fields

    #region Methods

    void SpawnBattleship()
    {
        //create the game object
        GameObject ship = OT.CreateObject("EnemyShipBattleship");
        myShip = ship.GetComponent<OTSprite>();

        //place it near the edge of the screen and in the high zone
        float shipY = Random.value * (int)(SpaceZone.Top-SpaceZone.High)+(int)SpaceZone.High;
        myShip.position = new Vector2(-50.0f,shipY);
        myShip.renderer.enabled = true;

        //Adjust the new ship's attributes based on level
        EnemyShip shipLogic = (EnemyShip)myShip.GetComponent(typeof(EnemyShip));
        shipLogic.moveSpeed = Battleship.moveSpeedBase+(Battleship.moveSpeedMultiplier*battleshipsLevel);
        shipLogic.health = Battleship.healthBase+(int)(Battleship.healthMultiplier*battleshipsLevel);

        Battleship battleshipLogic = (Battleship)myShip.GetComponent(typeof(Battleship));
        battleshipLogic.reloadTimeBeam = Battleship.reloadTimeBeamBase-(Battleship.reloadTimeBeamMultiplier*battleshipsLevel);
        battleshipLogic.reloadTimeBomb= Battleship.reloadTimeBombBase-(Battleship.reloadTimeBombMultiplier*battleshipsLevel);
        battleshipLogic.beamDamage = Battleship.beamDamageBase+(int)(Battleship.beamDamageMultiplier*battleshipsLevel);
        battleshipLogic.bombDamage = Battleship.bombDamageBase+(int)(Battleship.bombDamageMultiplier*battleshipsLevel);
        battleshipLogic.projectileSpeed = Battleship.bombSpeedBase+(Battleship.bombSpeedMultiplier*battleshipsLevel);
        battleshipLogic.resourceReward = Constants.BS_RESOURCE_REWARD;
        Targets.enemyTargets.Add(myShip);
        print(Targets.enemyTargets.Count);
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:32,代码来源:WaveGenerator.cs


示例8: Attack

    void Attack()
    {
        //Determine if firing by picking a random number
        if (Random.Range(0,101) <= shotCoefficient)
        {
            for (int i = -1; i<3;i++)
            {
                //Generate a projectile
                float offsetX = i*1.4f - 0.7f;
                GameObject bullet = OT.CreateObject("EnemyProjectile");
                myProjectile = bullet.GetComponent<OTSprite>();
                myProjectile.renderer.enabled = true;

                Vector2	target = new Vector2(sprite.position.x+offsetX,-50.0f);
                myProjectile.position = new Vector2(sprite.position.x+offsetX,sprite.position.y);
                myProjectile.RotateTowards(target);

                //Assign the projectile its atributes.
                EnemyProjectile ep = (EnemyProjectile)myProjectile.GetComponent(typeof(EnemyProjectile));
                ep.speed = projectileSpeed;
                ep.damage = projectileDamage;
                ep.attackType = attackType;

                //Make shot unavailable
                timeSinceLastShot = 0.0f;
            }
        }
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:28,代码来源:PlanetDecimator.cs


示例9: Start

 // Use this for initialization
 void Start()
 {
     sprite = GetComponent<OTSprite>();
     if (arrowColors!=null && arrowColors.Length>0)
         sprite.tintColor = arrowColors[(int)Mathf.Floor(Random.value * (arrowColors.Length-0.1f))];
     StartTween(null);
 }
开发者ID:borderpointer,项目名称:zhoras-adventure,代码行数:8,代码来源:Arrow.cs


示例10: Attack

    void Attack()
    {
        //Only attack if there is something to attack
        if (Targets.enemyTargets.Count > 0)
        {
            timeSinceLastShot = 0.0f;
            //fire a player projectile towards an enemy ship
            GameObject missile = OT.CreateObject("PlayerMissile");
            myProjectile = missile.GetComponent<OTSprite>();
            myProjectile.renderer.enabled = true;

            // Pick a target, and fire at it
            Vector2 target = Targets.PickRandomEnemyTarget().position;
            target = new Vector2(target.x,target.y);
            myProjectile.position = sprite.position;
            //myProjectile.RotateTowards(target);		//start the missiles off facing straight up

            //Assign the projectile its atributes.
            PlayerMissile pm = (PlayerMissile)myProjectile.GetComponent(typeof(PlayerMissile));
            pm.damage = damage;
            pm.speed = projectileSpeed;
            pm.isHarvester = false;
            pm.isSmart = false;
        }
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:25,代码来源:MissileLauncher.cs


示例11: Start

	// Use this for initialization
	void Start () {
		GameObject.Find("DragStart").renderer.enabled = false;
		GameObject.Find("Dragging").renderer.enabled = false;
		GameObject.Find("DragEnd").renderer.enabled = false;				

		sprite = GetComponent<OTSprite>();
		// mark this sprite to be draggable
		sprite.draggable = true;
		// hookup our drag events
		sprite.onDragStart = DragStart;
		sprite.onDragEnd = DragEnd;
		sprite.onDragging = Dragging;
		sprite.onReceiveDrop = ReceiveDrop;
		
		// when we drag we will drag the sprite at depth -50
		// so the sprite will always be ontop when dragging
		// it will snap back into its original position on release
		sprite.dragDepth = -50;
		
		// when we drag we will drag the sprite at an alpha value 
		// of 0.5f
		sprite.dragAlpha = .5f;
				
		// set the sprite world boundary
		sprite.BoundBy(GameObject.Find("back").GetComponent<OTObject>());
		
	}
开发者ID:pravusjif,项目名称:PravusUnityTests,代码行数:28,代码来源:DragTest.cs


示例12: Attack

    void Attack()
    {
        timeSinceLastShot = 0.0f;
        //fire a player beam towards an enemy ship
        GameObject beam = OT.CreateObject("PlayerBeam");
        myProjectile = beam.GetComponent<OTSprite>();
        myProjectile.renderer.enabled = false; //Beams appear after a short time in flight

        // Pick a target, and fire at it
        // TODO add target picking code for slug
        Vector2 target = Targets.PickRandomEnemyTarget().position;
        //We don't want the beams to be perfectly accurate, so offset the x and y by between (-1,1)
        float offsetX = Random.value*2.0f-1.0f;
        float offsetY = Random.value*2.0f-1.0f;
        target = new Vector2(target.x+offsetX,target.y+offsetY);
        myProjectile.position = sprite.position;
        myProjectile.RotateTowards(target);

        //Assign the projectile its atributes.
        PlayerBeam pb = (PlayerBeam)myProjectile.GetComponent(typeof(PlayerBeam));
        pb.damage = damage;
        pb.maxFlightTime = flightTime;
        pb.flightTime = 0.0f;
        pb.isStun = true;
        pb.stunDuration = stunDuration;
        pb.isLaser = false;
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:27,代码来源:StunCannon.cs


示例13: Start

 // Use this for initialization
 void Start()
 {
     damage = 10;
     targetable = false;
     sprite = GetComponent<OTSprite>();
     sprite.onCollision = OnCollision;
 }
开发者ID:dreamlane,项目名称:Brokion,代码行数:8,代码来源:EnemyProjectile.cs


示例14: Attack

    void Attack()
    {
        //Determine if firing by picking a random number
        if (Random.Range(0,101) <= shotCoefficient)
        {
            //Generate a projectile
            GameObject bullet = OT.CreateObject("EnemyProjectile");
            myProjectile = bullet.GetComponent<OTSprite>();
            myProjectile.renderer.enabled = true;

            // Pick a target, and fire at it
            Vector2 target = Targets.PickRandomTargetFromAll().position;
            myProjectile.position = sprite.position;
            myProjectile.RotateTowards(target);

            //Assign the projectile its atributes.
            EnemyProjectile ep = (EnemyProjectile)myProjectile.GetComponent(typeof(EnemyProjectile));
            ep.speed = projectileSpeed;
            ep.damage = projectileDamage;
            ep.attackType = attackType;

            //Make shot unavailable
            timeSinceLastShot = 0.0f;
        }
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:25,代码来源:Carrier.cs


示例15: InitBall

 public void InitBall(float size, float speed, float rotationSpeed)
 {
     sprite = this.GetComponent<OTSprite>();
     sprite.size=new Vector2(size,size);
     this.speed=new Vector2(speed,speed);
     this.rotationSpeed=rotationSpeed;
     sprite.position=new Vector2(Random.Range(-640,640),Random.Range(-50,250));
 }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:8,代码来源:Ball.cs


示例16: Start

    // Use this for initialization
    void Start()
    {
        sprite = GetComponent<OTSprite>();
        gunAnimation = GetComponent<OTAnimatingSprite>();
        bang = bangGameObject.GetComponent<ParticleSystem>();

        gunAnimation.onAnimationFinish = shoot;
    }
开发者ID:AlexTiTanium,项目名称:Kombain-game,代码行数:9,代码来源:Shooter.cs


示例17: RegisterGoon

 public void RegisterGoon(OTSprite goon)
 {
     if(! _mob.Contains(goon))
     {
         _mob.Add(goon);
         goon.GetComponent<MonsterManager>().SetMobManager(this);
     }
 }
开发者ID:rtm907,项目名称:C--Unity-Game-Exercise,代码行数:8,代码来源:MobManager.cs


示例18: SpawnEffect

 private void SpawnEffect(Vector2 position)
 {
     GameObject temp = OT.CreateObject("visualEffect");
     OTSprite sprite = temp.GetComponent<OTSprite>();
     sprite.tintColor = Color.blue;
     sprite.position = position;
     _targetEffect = sprite;
 }
开发者ID:rtm907,项目名称:C--Unity-Game-Exercise,代码行数:8,代码来源:testBotManager.cs


示例19: Start

    void Start()
    {
        gameState = (GameState)GameObject.Find("GameLogic").GetComponent(typeof(GameState));
        sprite = GetComponent<OTSprite>();

        timeSinceLastShot = 0.0f;
        dead = false;
    }
开发者ID:dreamlane,项目名称:Brokion,代码行数:8,代码来源:MissileLauncher.cs


示例20: Setup

 // Use this for initialization
 public void Setup(LevelManager _lev)
 {
     levMan = _lev;
     blocker = transform.parent.GetComponentInChildren<DoorBlock>();
     this.blockSpr = FETool.findWithinChildren(this.gameObject, "BlockT").GetComponentInChildren<OTSprite>();
     getRotation();
     transform.rotation = Quaternion.Euler(new Vector3(0f,0f, closedAngle));
 }
开发者ID:Tavrox,项目名称:PuzzleRunner,代码行数:9,代码来源:Door.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# OUTPUTTYPE类代码示例发布时间:2022-05-24
下一篇:
C# OTObject类代码示例发布时间: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