本文整理汇总了C#中IActor类的典型用法代码示例。如果您正苦于以下问题:C# IActor类的具体用法?C# IActor怎么用?C# IActor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IActor类属于命名空间,在下文中一共展示了IActor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
m_Grid = GameObject.FindGameObjectWithTag("Grid").GetComponent<Grid>();
m_target = m_Grid.GetRandGrid();
m_actor = GetComponent<IActor>();
m_path = new List<GridNode>();
}
开发者ID:OnionMoeCat,项目名称:AI-Assignments,代码行数:8,代码来源:PathfollowingController.cs
示例2: GetOutputPlugs
public IOutputPlug[] GetOutputPlugs(IActor actor, IInputPlug plug)
{
List<IOutputPlug> tempList = new List<IOutputPlug>();
foreach (IOutputPlug p in outputPlugs)
{
// Cases to add.
if (plug != null)
{
if (p.IsCompatible(plug))
tempList.Add(p);
}
else if (actor != null)
{
foreach (IInputPlug ip in actor.GetInputPlugs(null, null))
{
if (p.IsCompatible(ip))
{
tempList.Add(p);
break;
}
}
}
else
{
tempList.Add(p);
}
}
return tempList.ToArray();
}
开发者ID:BackupTheBerlios,项目名称:proteus-svn,代码行数:31,代码来源:PlugCollection.cs
示例3: EnterLocation
/// <summary>
/// Method that get called when a player want to enter a location also notifies to trip
/// recorder that player entered location
/// </summary>
/// <param name="actor"></param>
/// <returns></returns>
public virtual bool EnterLocation(IActor actor)
{
actor.CurrentLocation = this;
//Console.WriteLine("cell {0} entered by actor {1}", LocationName, actor.Name);
Recorder.EnterLocation(actor.Name, LocationName);
return true;
}
开发者ID:akrem1st,项目名称:Assignment2c-git,代码行数:13,代码来源:Location.cs
示例4: FindConfigFile
public static ConfigFileActor FindConfigFile(IActor actor)
{
if (actor.Environment != null)
{
IActor currentActor = actor.Environment.Owner;
if (currentActor != null)
{
while (!(currentActor is ConfigFileActor))
{
currentActor = currentActor.Environment.Owner;
if (currentActor == null)
break;
}
if (currentActor != null)
{
if (currentActor is ConfigFileActor)
{
return (ConfigFileActor)currentActor;
}
}
}
}
return null;
}
开发者ID:BackupTheBerlios,项目名称:proteus-svn,代码行数:28,代码来源:Actor.cs
示例5: PWUnit
public PWUnit(IActor actor)
{
actor = Compatibility.Check<IPWRobot>(this, actor);
// actor.World.Clocks.AddTrigger(new TimerTrigger(UpdateSpeed, TriggerFrequency)); adding trigger example
rules = Compatibility.Check<IPWRules>(this, actor.Rules);
}
开发者ID:mironov-alexey,项目名称:uCvarc,代码行数:7,代码来源:PWUnit.cs
示例6: PositionComponent
public PositionComponent(IActor actor, IClientSyncComponent syncComponent, ILogger logger)
: base(actor)
{
_logger = logger;
_syncComponent = syncComponent;
_syncComponent.MessageReceived += new EventHandler<Core.Utility.EventArgs<Tuple<Core.Networking.IConnection, Core.Networking.Messages.ActorMessage>>>(_syncComponent_MessageReceived);
}
开发者ID:AugustoAngeletti,项目名称:blockspaces,代码行数:7,代码来源:PositionComponent.cs
示例7: PositionComponent
public PositionComponent(IActor actor, IServerSyncComponent syncComponent)
: base(actor)
{
_syncComponent = syncComponent;
_syncComponent.ConnectionEnteringRelevantSet += new EventHandler<Core.Utility.EventArgs<Core.Networking.IConnection>>(_syncComponent_ConnectionEnteringRelevantSet);
sendPosition();
}
开发者ID:AugustoAngeletti,项目名称:blockspaces,代码行数:7,代码来源:PositionComponent.cs
示例8: EnterLocation
/// <summary>
/// player can enter a location
/// </summary>
/// <param name="actor"></param>
/// <returns></returns>
public override bool EnterLocation(IActor actor)
{
if (base.EnterLocation(actor)) {
actor.CurrentLocation = this;
return true;
} else return false;
}
开发者ID:akrem1st,项目名称:Assignment2d,代码行数:12,代码来源:WaterLocation.cs
示例9: ExitLocation
public override void ExitLocation(IActor player)
{
DeadEnd(_location);
Exit();
_location.EnterLocation(player);
_update = new UpdateRequest(player, _location, _check);
}
开发者ID:dataartisan,项目名称:Project2C,代码行数:7,代码来源:ContainerLocation.cs
示例10: Preprocess
public IEnumerable<ICommand> Preprocess(IActor actor, ICommand command)
{
if (!(command is IDWMCommand))
{
yield return command;
yield break;
}
var cmd = command as IDWMCommand;
if (cmd.DifWheelMovement == null)
{
yield return command;
yield break;
}
cmd.DifWheelMovement = new DifWheelMovement
{
LeftRotatingVelocity=cmd.DifWheelMovement.LeftRotatingVelocity*Multiplier,
RightRotatingVelocity = cmd.DifWheelMovement.RightRotatingVelocity*Multiplier,
Duration=cmd.DifWheelMovement.Duration,
};
yield return cmd as ICommand;
}
开发者ID:mironov-alexey,项目名称:uCvarc,代码行数:26,代码来源:DWMDistortionCommandFilter.cs
示例11: CreateModifier
public IModifier CreateModifier(IActor target, IActor source, IStat stat, int amount)
{
IModifier modifier = this.CreateModifier(target, source, amount);
modifier.SetAffectedStat(stat);
return modifier;
}
开发者ID:danec020,项目名称:MudEngine,代码行数:7,代码来源:ModifierFactory.cs
示例12: GetRegionFromPosition
public static Region GetRegionFromPosition(IActor actor)
{
Console.WriteLine(string.Format("posX {0} - posY {1}",actor.posX,actor.posY));
int indexX = GetIndex(actor.posX);
int indexY = GetIndex(actor.posY);
return Region.arrRegion[indexX, indexY];
}
开发者ID:anhle128,项目名称:demo_photon_with_unity,代码行数:7,代码来源:Region.cs
示例13: Explore
private void Explore(IActor actor, ILocation location)
{
//If an exit location is found, print the path and continue to find another exit
if (location is ExitLocation)
{
if ((location as ExitLocation).ExitPreviouslyFound)
return;
(location as ExitLocation).ExitPreviouslyFound = true;
NumberOfExits++;
TripRecorder.Instance.PrintTrip();
terrain.PathToExit();
terrain.TerrainPrinter(terrain.StartLocation);
str= String.Format("{0} Number Of Exit(s) Found!", NumberOfExits);
Console.WriteLine(str);
Console.WriteLine("*****************************************************************");
return;
}
//When the location is dead end
if (location.ListOfNeighbors().Count == 0)
{
(location as MarkedLocation).MarkRed();
return;
}
//traverses to all the neigbors of a location
foreach (var neighbor in location.ListOfNeighbors())
{
location.MoveToNeighbor(actor, neighbor.Key);
Explore(actor, neighbor.Value);
}
//The location will be marked red when it backtracks
(location as MarkedLocation).MarkRed();
}
开发者ID:akrem1st,项目名称:Assignment2c-git,代码行数:34,代码来源:TerrainAutoExploration.cs
示例14: SimpleSyncComponent
public SimpleSyncComponent(IActor actor, IConnectionManager connectionManager)
{
_actor = actor;
_connectionManager = connectionManager;
_connectionManager.ConnectionInitialized += new EventHandler<EventArgs<IConnection>>(_connectionManager_ConnectionInitialized);
_connectionManager.ConnectionTerminated += new EventHandler<EventArgs<IConnection>>(_connectionManager_ConnectionTerminated);
}
开发者ID:AugustoAngeletti,项目名称:blockspaces,代码行数:7,代码来源:SimpleSyncComponent.cs
示例15: interact
public void interact(IActor actor)
{
if (canInteract(actor)) {
ICommand command = new PickUpCommand(actor, item);
command.execute();
}
}
开发者ID:evilcandybag,项目名称:DwarfSplat,代码行数:7,代码来源:ItemOnGround.cs
示例16: Explore
/// <summary>
/// explores the terrain
/// </summary>
public void Explore(Terrain terrain, IActor actor)
{
this.terrain = terrain;
//the Explore starts from the start location in the terrain
Explore(terrain.StartLocation, actor);
Console.WriteLine("**** There are no more Exits ************");
}
开发者ID:akrem1st,项目名称:Assignment2d,代码行数:10,代码来源:TerrainAutoExploration.cs
示例17: Use
public void Use(IActor targetActor)
{
//get variables
IChunk chunk = this.Chunk;
int x = this.Position.X;
int y = this.Position.Y;
int z = this.Position.Z;
IActor actor = targetActor;
//permission check, is the Player allowed to open the door?
Chunk castedChunk = chunk as Chunk;
string nationName = castedChunk.NationOwner;
if ((!string.IsNullOrEmpty(nationName) && (actor.Nation != nationName)))
return;
//get the index for the Block array from the given x, y and z
int index = chunk.GetBlockIndex(x, y, z);
//get the specific Block data by its index
ushort currentBlock = chunk.Blocks[index];
if (IsOdd((int)currentBlock))
{
chunk.ChangeBlock((ushort)(currentBlock - 1), x, y, z);
}
else
{
chunk.ChangeBlock((ushort)(currentBlock + 1), x, y, z);
}
}
开发者ID:Retoc,项目名称:MoreBlocks,代码行数:29,代码来源:SingleBlockToggle.cs
示例18: AddActor
public void AddActor(int actorId, IActor actor)
{
lock (_lock)
{
_actors.Add(actorId, actor);
}
}
开发者ID:snjee,项目名称:actor-http,代码行数:7,代码来源:ExternalThread.cs
示例19: Use
public void Use(IActor targetActor)
{
//get variables
IChunk chunk = this.Chunk;
int x = this.Position.X;
int y = this.Position.Y;
int z = this.Position.Z;
IActor actor = targetActor;
//permission check, is the Player allowed to open the door?
Chunk castedChunk = chunk as Chunk;
string nationName = castedChunk.NationOwner;
if ((!string.IsNullOrEmpty(nationName) && (actor.Nation != nationName)))
return;
//get the index for the Block array from the given x, y and z
int index = chunk.GetBlockIndex(x, y, z);
//get the specific Block data by its index
ushort currentBlock = chunk.Blocks[index];
//get baseDoorID (reason why the doorID has to be a multiple of 10, for this script to properly work)
int baseDoorID = ((int)currentBlock / 10) * 10;
int offset = (int)currentBlock - baseDoorID;
//call ToggleDoors function with variables
ToggleDoor(chunk, baseDoorID, offset, x, y, z);
}
开发者ID:Retoc,项目名称:MoreBlocks,代码行数:27,代码来源:DoorToggle.cs
示例20: BuildDispatchingMethod
private static DynamicMethod BuildDispatchingMethod(IActor handler, IStructSizeCounter counter,
Func<Type, int> messageIdGetter)
{
var handlerType = handler.GetType();
var handleMethods = ActorRegistry.GetHandleMethods(handlerType)
.ToDictionary(m => messageIdGetter(m.GetParameters()[1].ParameterType.GetElementType()), m => m)
.OrderBy(kvp => kvp.Key)
.ToArray();
var dm = new DynamicMethod("ReadMessagesFor_" + handlerType.Namespace.Replace(".", "_") + handlerType.Name,
typeof (void), new[] {typeof (MessageReader), typeof (int), typeof (ByteChunk)},
handlerType.Assembly.Modules.First(), true);
var actorField = typeof (MessageReader).GetFields(BindingFlags.NonPublic | BindingFlags.Instance)
.Single(fi => fi.FieldType == typeof (IActor));
var il = dm.GetILGenerator();
// push handler
il.Emit(OpCodes.Ldarg_0);
il.Emit(OpCodes.Ldfld, actorField);
il.Emit(OpCodes.Castclass, handlerType);
var endLbl = il.DefineLabel();
// dispatch
foreach (var method in handleMethods)
{
var lbl = il.DefineLabel();
il.Emit(OpCodes.Ldarg_1); // messageTypeId
il.Emit(OpCodes.Ldc_I4, method.Key);
il.Emit(OpCodes.Ceq);
il.Emit(OpCodes.Brfalse_S, lbl);
// push envelope
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldfld, typeof (ByteChunk).GetField("Pointer"));
//var messageType = method.Value.GetParameters()[1].ParameterType.GetElementType();
//il.Emit(OpCodes.Ldc_I4, (int)Marshal.OffsetOf(messageType, Envelope.FieldName));
//il.Emit(OpCodes.Add);
// push message
il.Emit(OpCodes.Ldarg_2);
il.Emit(OpCodes.Ldfld, typeof (ByteChunk).GetField("Pointer"));
il.EmitCall(OpCodes.Callvirt, method.Value, null);
il.Emit(OpCodes.Br_S, endLbl);
il.MarkLabel(lbl);
}
// nothing was called, pop
il.Emit(OpCodes.Pop);
// end label
il.MarkLabel(endLbl);
il.Emit(OpCodes.Ret);
return dm;
}
开发者ID:Scooletz,项目名称:RampUp,代码行数:59,代码来源:MessageReader.cs
注:本文中的IActor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论