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


C# Float3.ToString方法代码示例

本文整理汇总了C#中CSharpAI.Float3.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Float3.ToString方法的具体用法?C# Float3.ToString怎么用?C# Float3.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CSharpAI.Float3的用法示例。


在下文中一共展示了Float3.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExploreWith

 void ExploreWith( int unitid )
 {
     Float3 destination = new Float3();
    // if( PriorityTargets.Count > 0 )
    // {            
   //      destination = PriorityTargets.Dequeue() as Float3;
   //      logfile.WriteLine( "dequeued next destination: " + destination.ToString() );
   //  }
   //  else
   //  {
         destination.x = random.Next(0, aicallback.GetMapWidth() * MovementMaps.SQUARE_SIZE );
         destination.z = random.Next( 0, aicallback.GetMapHeight() * MovementMaps.SQUARE_SIZE );
         destination.y = aicallback.GetElevation( destination.x, destination.y );
         logfile.WriteLine( "mapwidth: " + aicallback.GetMapWidth() + " squaresize: " + MovementMaps.SQUARE_SIZE );
         logfile.WriteLine( "ScoutController sending scout " + unitid + " to " + destination.ToString() );
   //  }
     //aicallback.GiveOrder( unitid, new Command( Command.CMD_MOVE, destination.ToDoubleArray() ) );
     GiveOrderWrapper.GetInstance().MoveTo(unitid, destination);
 }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:19,代码来源:ScoutControllerRaider.cs

示例2: csai_UnitDamagedEvent

        // cheap hack to respond to enemy shooting us
        void csai_UnitDamagedEvent(int damaged, int attacker, float damage, Float3 dir)
        {
            /*
            if (!EnemyUnitDefByDeployedId.ContainsKey(attacker))
            {
                EnemyUnitDefByDeployedId.Add(attacker, aicallback.GetUnitDef(attacker));
            }
             */
            //if (!EnemyStaticPosByDeployedId.ContainsKey(attacker))
            //{
            Float3 enemypos = aicallback.GetUnitPos(attacker);
            if (enemypos != null &&
                Float3Helper.GetSquaredDistance(enemypos, new Float3(0, 0, 0)) > 10 * 10)
            {
                logfile.WriteLine("unitdamaged, attacker " + attacker + " pos " + enemypos);
                if (!EnemyStaticPosByDeployedId.ContainsKey(attacker))
                {
                    EnemyStaticPosByDeployedId.Add(attacker, enemypos);
                }
                else
                {
                    EnemyStaticPosByDeployedId[attacker] = enemypos;
                }
                if (NewStaticEnemyAddedEvent != null)
                {
                    NewStaticEnemyAddedEvent(attacker, enemypos, null);
                }
            }
            else // else we guess...
            {
                if (FriendlyUnitPositionObserver.GetInstance().PosById.ContainsKey(damaged))
                {
                    Float3 ourunitpos = FriendlyUnitPositionObserver.GetInstance().PosById[damaged];
                    if (ourunitpos != null)
                    {
                        Float3 guessvectortotarget = dir * 300.0;
                        logfile.WriteLine("vectortotarget guess: " + guessvectortotarget.ToString());
                        Float3 possiblepos = ourunitpos + guessvectortotarget;

                        if (!EnemyStaticPosByDeployedId.ContainsKey(attacker))
                        {
                            EnemyStaticPosByDeployedId.Add(attacker, possiblepos);
                        }
                        else
                        {
                            EnemyStaticPosByDeployedId[attacker] = possiblepos;
                        }

                        if (NewStaticEnemyAddedEvent != null)
                        {
                            NewStaticEnemyAddedEvent(attacker, possiblepos, null);
                        }
                        logfile.WriteLine("unitdamaged, attacker " + attacker + " our unit pos " + ourunitpos + " dir " + dir.ToString() + " guess: " + possiblepos.ToString());
                    }
                }
            }
            //}
        }
开发者ID:genxinzou,项目名称:svn-spring-archive,代码行数:59,代码来源:EnemyController.cs

示例3: DoSomething

        /*
        void DoSomething()
        {
            logfile.WriteLine( "CommanderController.DoSomething()" );
            IUnitDef factorydef = buildtable.UnitDefByName[ "armvp" ] as IUnitDef;
            IUnitDef radardef = buildtable.UnitDefByName[ "armrad" ] as IUnitDef;

            if( aicallback.GetEnergy() * 100 / aicallback.GetEnergyStorage() < 10 )
            {
                CommanderBuildPower();
            }
            else if( aicallback.GetMetal() * 100 / aicallback.GetMetalStorage() < 50 )
            {
                CommanderBuildExtractor();
            }
            else if( FactoryController.GetInstance().FactoryUnitDefByDeployedId.Count > 0 &&
                PowerController.GetInstance().CanBuild( radardef ) &&
                RadarController.GetInstance().NeedRadarAt( aicallback.GetUnitPos( commanderid ) ) )
            {
                CommanderBuildRadar();
            }
            else
            {
                if( MetalController.GetInstance().CanBuild( factorydef ) )
                {
                    if( PowerController.GetInstance().CanBuild( factorydef ) )
                    {
                        CommanderBuildFactory();
                    }
                    else
                    {
                        CommanderBuildPower();
                    }
                }
                else
                {
                    CommanderBuildExtractor();
                }
            }
        }
        */
        public void VoiceCommandCommanderBuildAt( string chatstring, string[] splitchatstring, int player )
        {
            string unitname = splitchatstring[2];
            IUnitDef unitdef = buildtable.UnitDefByName[ unitname.ToLower() ] as IUnitDef;
            if( unitdef == null )
            {
                aicallback.SendTextMsg( "Unit " + unitname + " not found.", 0 );
                return;
            }

            Float3 pos = new Float3();
            pos.x = Convert.ToDouble( splitchatstring[3] );
            pos.z = Convert.ToDouble( splitchatstring[4] );
            pos.y =  aicallback.GetElevation( pos.x, pos.z );

            aicallback.SendTextMsg( "giving build order, id " + unitdef.humanName + " at " + pos.ToString(), 0 );

            CommanderBuildAt( unitdef, pos );
        }
开发者ID:achoum,项目名称:spring,代码行数:60,代码来源:CommanderController.cs

示例4: CommanderBuildAt

 void CommanderBuildAt( IUnitDef unitdef, Float3 buildsite )
 {
     logfile.WriteLine( "Commander building " + unitdef.name + " at " + buildsite.ToString() );
     aicallback.DrawUnit(unitdef.name, buildsite, 0.0f, 500, aicallback.GetMyAllyTeam(), true, true);
     aicallback.GiveOrder( commanderid, new Command( - unitdef.id, buildsite.ToDoubleArray() ) );
 }
开发者ID:achoum,项目名称:spring,代码行数:6,代码来源:CommanderController.cs

示例5: BuildAt

        void BuildAt( int constructorid, IUnitDef unitdef, Float3 buildsite )
        {
            IUnitDef placeholder;
            /*
            if( unitdef.name.ToLower() == "armmex" ) // use smaller placeholder for mexes so fit closer to intended metalspot
            {
                placeholder = buildtable.UnitDefByName[ "ARMMOHO".ToLower() ] as IUnitDef;
            }
            else
            {
                placeholder = buildtable.UnitDefByName[ "CORGANT".ToLower() ] as IUnitDef;
            }
            buildsite = aicallback.ClosestBuildSite( placeholder, buildsite, 1400.0, 2 );
            buildsite = aicallback.ClosestBuildSite( unitdef, buildsite, 1400.0, 2 );
            */
            if( unitdef.name == "ARMMEX" )
            {
                placeholder = buildtable.UnitDefByName[ "ARMMOHO".ToLower() ] as IUnitDef;
                buildsite = aicallback.ClosestBuildSite( placeholder, buildsite, 1400.0, 2 );
                buildsite = aicallback.ClosestBuildSite( unitdef, buildsite, 1400.0, 2 );
            }
            else
            {
                buildsite = BuildPlanner.GetInstance().ClosestBuildSite( unitdef, buildsite, 3000 );
                buildsite.y = aicallback.GetElevation( buildsite.x, buildsite.z );
                buildsite = aicallback.ClosestBuildSite( unitdef, buildsite, 1400, 2 );
            }

            logfile.WriteLine( "building " + unitdef.name + " at " + buildsite.ToString() );
            if( ShowNextBuildSite )
            {
                aicallback.DrawUnit(unitdef.name, buildsite, 0.0f, 500, aicallback.GetMyAllyTeam(), true, true);
            }
            aicallback.GiveOrder( constructorid, new Command( - unitdef.id, buildsite.ToDoubleArray() ) );
        }
开发者ID:achoum,项目名称:spring,代码行数:35,代码来源:ConstructorController.cs


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