本文整理汇总了C#中ObjectType类的典型用法代码示例。如果您正苦于以下问题:C# ObjectType类的具体用法?C# ObjectType怎么用?C# ObjectType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectType类属于命名空间,在下文中一共展示了ObjectType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Hero
public Hero(ObjectType mObjectType, ContentManager content,
SpriteState defaultState, Vector2 SpritePosition)
: base(mObjectType, content, defaultState, SpritePosition, Hostility.FRIENDLY)
{
mSpriteScale = 0.8f;
this.mSprite.SpriteScale = mSpriteScale;
this.hostility = Hostility.FRIENDLY;
SetUnitAnimation();
mTarget = SpritePosition;
mBehaviorHero = new BehaviorHero(1.0f, mTarget);
mObjectID = mGlobalID;
mGlobalID++;
mheroAttribute = new HeroAttribute(this, content);
SetAttributes();
int mAttackLevel = (int)HeroAttribute.AttackUpgradeLevel;
int mDefenseLevel = (int)HeroAttribute.DefenseUpgradeLevel;
for (int i = 0; i < mAttackLevel; i++)
{
mheroAttribute.UpgradeAttack();
}
for (int i = 0; i < mDefenseLevel; i++)
{
mheroAttribute.UpgradeDefense();
}
}
示例2: CreateTempFile
public static async Task<ObjectWriteResult> CreateTempFile(ObjectType type, int length, byte[] data, string rootPath)
{
var name = Path.Combine(rootPath, "tmp" + _random.Next(0, int.MaxValue));
using (var file = File.OpenWrite(name))
using (var stream = CompressionStream.CompressStream(file))
using (var md = new MessageDigest())
{
var header = Encoding.ASCII.GetBytes(string.Format("{0} {1}\0", type.ToTypeCode(), length));
await stream.WriteAsync(header, 0, header.Length);
await stream.WriteAsync(data, 0, data.Length);
md.Update(header);
md.Update(data);
var digest = md.Digest();
return new ObjectWriteResult
{
FileInfo = new FileInfo(name),
ObjectId = Helper.ByteArrayToId(digest)
};
}
}
示例3: Camera3D
public Camera3D(string id, ObjectType objectType,
Transform3D transform, ProjectionParameters projectionParameters, Viewport viewPort)
: base(id, objectType, transform)
{
this.projectionParameters = projectionParameters;
this.viewPort = viewPort;
}
示例4: ReadHeader
private static void ReadHeader(Stream stream, out ObjectType type, out int size)
{
size = 0;
var typeCode = string.Empty;
var sb = new StringBuilder();
var inHeader = true;
while (inHeader)
{
var c = (char)stream.ReadByte();
switch (c)
{
case ' ':
typeCode = sb.ToString();
sb.Clear();
continue;
case '\0':
size = int.Parse(sb.ToString());
sb.Clear();
inHeader = false;
continue;
}
sb.Append(c);
}
type = ObjectTypeFromString(typeCode);
}
示例5: verifyTarget
public void verifyTarget(GameObject obj)
{
if (_targetType != ObjectType.Unknown)
{
if (obj == _target)
{
if (hoverObject != null)
{
if (hoverObject.GetComponent<ActionTile>())
{
Debug.Log("item");
hoverObject.GetComponent<ActionTile>().ClickAction(this.gameObject);
}
if (hoverObject.GetComponent<ActionCharacter>())
{
Debug.Log("character");
hoverObject.GetComponent<ActionCharacter>().ClickAction();
}
hoverObject = null;
}
else
{
Debug.Log("no action possible");
}
_targetPos.x = this.transform.position.x;
_targetPos.y = this.transform.position.y;
scriptAnim.hasAnim = false;
this.rigidbody.velocity = new Vector3(0, 0, 0);
_targetType = ObjectType.Unknown;
}
}
}
示例6: DrawnActor
public DrawnActor(string id, ObjectType objectType, Transform3D transform, Effect effect, Color color, float alpha)
: base(id, objectType, transform)
{
this.Effect = effect;
this.Color = color;
this.Alpha = alpha;
}
示例7: GetObject
public GameObject GetObject(ObjectType type, Vector3 pos, Quaternion rot)
{
switch(type)
{
case ObjectType.Bullet:
tempList = BulletList;
break;
}
itemFound = false;
for(int i = 0; i < tempList.Count; i++)
{
if(!tempList[i].activeInHierarchy)
{
// Debug.Log("ItemFound");
tempList[i].SetActive(true);
tempObj = tempList[i];
tempObj.transform.position = pos;
tempObj.transform.rotation = rot;
itemFound = true;
break;
}
}
if(itemFound)
return tempObj;
else
return CreateNewObject(type, pos, rot);
}
示例8: ReadPrefix
public override int ReadPrefix(string shortSha, out ObjectId id, out UnmanagedMemoryStream data, out ObjectType objectType)
{
id = null;
data = null;
objectType = default(ObjectType);
ObjectId matchingKey;
int ret = ExistsPrefix(shortSha, out matchingKey);
if (ret != (int)ReturnCode.GIT_OK)
{
return ret;
}
ret = Read(matchingKey, out data, out objectType);
if (ret != (int)ReturnCode.GIT_OK)
{
return ret;
}
id = matchingKey;
return (int)ReturnCode.GIT_OK;
}
示例9: PrimitiveObject
public PrimitiveObject(string id, ObjectType objectType,
Transform3D transform, IVertexData vertexData, Effect effect, Color color, float alpha)
: base(id, objectType, transform, effect, color, alpha)
{
this.vertexData = vertexData;
this.effect = effect;
}
示例10: HitObject
/// <summary>
/// 构造物件
/// </summary>
/// <param name="x1">x坐标</param>
/// <param name="y1">y坐标</param>
/// <param name="hitTime1">击打时间</param>
/// <param name="type1">物件种类</param>
public HitObject(int x1, int y1, int hitTime1, ObjectType type1)
{
x = x1;
y = y1;
hitTime = hitTime1;
type = type1;
}
示例11: TrackCamera3D
public TrackCamera3D(string id, ObjectType objectType,
Transform3D transform, ProjectionParameters projectionParameters,
Viewport viewPort, Camera3DTrack track)
: base(id, objectType, transform, projectionParameters, viewPort)
{
this.track = track;
}
示例12: RequestPoolObject
public GameObject RequestPoolObject(ObjectType type, Vector3 position, Quaternion rotation)
{
if(objectPools[type].Count > 0)
{
// Get object of the specified kind from the pool
GameObject obj = objectPools[type].Pop();
// Set the specified position and rotation
obj.transform.position = position;
obj.transform.rotation = rotation;
// Enable the object
obj.SetActive(true);
return obj;
}
else if (objectCount < HardSizeLimit)
{
// Create new object of the specified type and set it as a child of the pool game object
GameObject obj = Instantiate (ObjectPrefabs[(int)type]);
obj.transform.parent = transform;
// Set the specified position and rotation
obj.transform.position = position;
obj.transform.rotation = rotation;
// Update object count
++objectCount;
return obj;
}
else
{
throw new System.Exception("Object Pool hard size limit reached. No more pool objects will be instantiated.");
}
}
示例13: DisablePoolObject
public void DisablePoolObject(GameObject obj, ObjectType type)
{
// Disable the object
obj.SetActive(false);
// Put it in the pool for this kind of object
objectPools[type].Push(obj);
}
示例14: ConcreteObject
protected ConcreteObject(ObjectType objectType, ConcreteObjectBuilder builder)
: base(objectType, builder)
{
m_name = builder.Name;
m_color = builder.Color;
m_materialID = builder.MaterialID;
}
示例15: ReadObjectHeader
public long ReadObjectHeader(out ObjectType type)
{
if (!IsStartOfStream)
Rewind();
long length;
string typeString = ReadWord().GetString();
switch (typeString)
{
case "blob":
type = ObjectType.Blob;
break;
case "commit":
type = ObjectType.Commit;
break;
case "tag":
type = ObjectType.Tag;
break;
case "tree":
type = ObjectType.Tree;
break;
default:
throw new ParseException("Unknown type: {0}".FormatWith(typeString));
}
length = ReadToNull().Sum(b => b);
return length;
}