本文整理汇总了C#中Actor.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Actor.GetType方法的具体用法?C# Actor.GetType怎么用?C# Actor.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Actor
的用法示例。
在下文中一共展示了Actor.GetType方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Hit
public void Hit(Actor actor, Vector3 direction, float force) {
if (actor.GetType() != typeof(Player) || fallen)
return;
Rigidbody rigidBody = GetComponent<Rigidbody>();
rigidBody.AddTorque(direction * this.force, ForceMode.Impulse);
}
示例2: OnTriggered
public void OnTriggered(Actor actor) {
if(actor.GetType() == typeof(Player)) {
actor.TakeDamage(gameObject, playerDamage * Time.deltaTime);
} else {
actor.TakeDamage(gameObject, aiDamage * Time.deltaTime);
}
}
示例3: ActorMessage
public void ActorMessage(Actor actor, string message, params object[] args)
{
if (IsEnabled() && actor.Id != null && actor.ActorService?.Context?.CodePackageActivationContext != null)
{
ActorMessage(
actor.GetType().ToString(),
actor.Id.ToString(),
actor.ActorService.Context.CodePackageActivationContext.ApplicationTypeName,
actor.ActorService.Context.CodePackageActivationContext.ApplicationName,
actor.ActorService.Context.ServiceTypeName,
actor.ActorService.Context.ServiceName.ToString(),
actor.ActorService.Context.PartitionId,
actor.ActorService.Context.ReplicaId,
actor.ActorService.Context.NodeContext.NodeName,
string.Format(message, args));
}
}
示例4: AssignToTarget
/// <summary>
/// Sets this health bar to respond to this actor
/// </summary>
public void AssignToTarget(Actor newTarget)
{
targetActor = newTarget;
if(targetActor.GetType() == typeof(MechActor)) {
MechActor mech = (MechActor)targetActor;
if(mech.armorWeaknessList.Length > 0) {
//weaknessIcon.enabled = true;
// TODO: allow for more than one weakness to be displayed in a litte list
//weaknessIcon.sprite = damageTypeIcons[(int)mech.armorWeaknessList[0]];
}
else {
//weaknessIcon.enabled = false;
}
}
}
示例5: OnTriggered
public void OnTriggered(Actor actor) {
// play sound
if(!triggered) {
spikesParent.transform.position = new Vector3(spikesParent.transform.position.x,
spikesParent.transform.position.y + spikesYOffset,
spikesParent.transform.position.z);
triggered = true;
}
if (actor.GetType() == typeof(Player))
actor.TakeDamage(gameObject, playerDamage);
else
actor.TakeDamage(gameObject, aiDamage);
spikesTimer = spikesTimerMax;
ParticleManager.InstantiateParticle(ParticleManager.Instance.Blood, actor.transform.position);
}
示例6: addToPath
public void addToPath(Actor l)
{
//first off, the obvious
if(!drawingLine) {
// Debug.Log("not moving right now.");
return;
}
if(movingActor == l) {
movingActor.restartPathCheck(this);
}
if(l.GetType() == typeof(Monster)) {
return;
}
//if first leaf, make sure it's adjacent to your head
if(movingActor != null && visitedLeaves.Count == 0 && !leafManager.isAdjacent(l, movingActor.row, movingActor.col)) {
// Debug.Log("not adjacent to monster head.");
return;
}
if(visitedLeaves.Count > 0 && !leafManager.isAdjacent(l, visitedLeaves[visitedLeaves.Count - 1])) {
// Debug.Log("not adjacent to last leaf.");
return;
}
if(visitedLeaves.Contains(l)) {
if(l == visitedLeaves[visitedLeaves.Count - 1]) {
// Debug.Log("is already the last leaf.");
return;
} else {
int index = visitedLeaves.IndexOf(l);
int numToRemove = visitedLeaves.Count - index;
visitedLeaves.RemoveRange(index, numToRemove);
}
}
if(!drawingLine || visitedLeaves.Count >= maxPathLength) {
return;
}
visitedLeaves.Add(l);
line.clearPositions();
for(int i = 0; i < visitedLeaves.Count; i++) {
Actor nl = visitedLeaves[i];
line.SetPosition(i+1, new Vector3(nl.col*tileSize, nl.row*tileSize, 0));
}
}
示例7: ActorMessage
public void ActorMessage(Actor actor, string message, [CallerFilePath] string source = "", [CallerMemberName] string method = "", params object[] args)
{
if (!IsEnabled())
{
return;
}
var finalMessage = string.Format(message, args);
ActorMessage(
actor.GetType().ToString(),
actor.Id.ToString(),
actor.ActorService.Context.CodePackageActivationContext.ApplicationTypeName,
actor.ActorService.Context.CodePackageActivationContext.ApplicationName,
actor.ActorService.Context.ServiceTypeName,
actor.ActorService.Context.ServiceName.ToString(),
actor.ActorService.Context.PartitionId,
actor.ActorService.Context.ReplicaId,
actor.ActorService.Context.NodeContext.NodeName,
GetClassFromFilePath(source) ?? "UNKNOWN",
method ?? "UNKNOWN",
finalMessage);
}
示例8: OnTriggered
public void OnTriggered(Actor actor) {
if (actor.GetType() == typeof(Player))
actor.TakeDamage(gameObject, playerDamage);
else
actor.TakeDamage(gameObject, aIDamage);
}