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


C# GameObject.GetHashCode方法代码示例

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


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

示例1: removeObject

 public void removeObject(GameObject obj)
 {
     GridData data = objectToGridData[obj.GetHashCode()];
     this.updateGrid(data.fromX, data.fromY, data.toX, data.toY, -data.cost);
     objectToGridData.Remove(obj.GetHashCode());
     //Debug.Log(string.Format("{0} at ({1},{2}) ({3}, {4})", obj.GetHashCode(), data.fromX, data.fromY, data.toX, data.toY));
 }
开发者ID:Ralusama19,项目名称:StudentsVsZombies,代码行数:7,代码来源:SceneGridManager.cs

示例2: findTarget

 private UnitBase findTarget(GameObject target)
 {
     foreach (UnitBase unit in UnitHandler.units)
     {
         if (unit.unit.GetHashCode() == target.GetHashCode())
             return unit;
     }
     return null;
 }      
开发者ID:ExaltedBagel,项目名称:TargetPractice,代码行数:9,代码来源:TargetCircle.cs

示例3: GetID

 public static string GetID(GameObject g)
 {
     foreach(KeyValuePair<string,GameObject> entry in objects) {
         if (entry.Value.GetHashCode().Equals(g.GetHashCode())) {
             return entry.Key;
             break;
         }
     }
     return "UnregisteredObject";
 }
开发者ID:srfoster,项目名称:CodeSpells,代码行数:10,代码来源:ObjectManager.cs

示例4: AddOnOutsideClickHandler

    internal void AddOnOutsideClickHandler(GameObject gameObject, Action action)
    {
        int hashCode = gameObject.GetHashCode();

        if (!_onOutsideClickHandlers.ContainsKey(hashCode))
        {
            _onOutsideClickHandlers.Add(hashCode, new ActionTracker(gameObject));
        }

        _onOutsideClickHandlers[hashCode].Add(action);
    }
开发者ID:TreyWheeler,项目名称:ProjectLilith,代码行数:11,代码来源:ClickTracker.cs

示例5: getUnit

 public static Unit getUnit(GameObject gameObject)
 {
     int hashCode = gameObject.GetHashCode();
     if (unitMap.ContainsKey(hashCode)){
         return unitMap[hashCode];
     }
     else
     {
         return null;
     }
 }
开发者ID:exolution,项目名称:cosmic-editor,代码行数:11,代码来源:UnitManager.cs

示例6: registerObject

 public void registerObject(GameObject obj, float x, float y, float width, float height, int cost)
 {
     GridData d = new GridData();
     d.cost = cost;
     d.xOffset = obj.transform.position.x - x;
     d.yOffset = obj.transform.position.y - y;
     getGridCoords(x - width/2, y - height/2, out d.fromX, out d.fromY);
     getGridCoords(x + width/2, y + height/2, out d.toX, out d.toY);
     objectToGridData[obj.GetHashCode()] = d;
     this.updateGrid(d.fromX, d.fromY, d.toX, d.toY, cost);
     //Debug.Log(string.Format("Registered object: {0} at ({1},{2}) ({3}, {4})", obj.GetHashCode(), d.fromX, d.fromY, d.toX, d.toY));
 }
开发者ID:Ralusama19,项目名称:StudentsVsZombies,代码行数:12,代码来源:SceneGridManager.cs

示例7: moveToPoint

    public static IEnumerator moveToPoint(GameObject subject, Vector3 targetPoint)
    {
        MotionAgent motionAgent;
        if (Instance.map.ContainsKey(subject.GetHashCode()))
        {
           motionAgent = Instance.map[subject.GetHashCode()];
            if (motionAgent.navMeshObstacle.enabled)
            {
                motionAgent.navMeshObstacle.enabled = false;
                yield return null;
                yield return null;
            }
            if (!motionAgent.navMeshAgent.enabled)
            {
                motionAgent.navMeshAgent.enabled = true;
            }
        }
        else
        {
            motionAgent = new MotionAgent(subject, targetPoint);
            motionAgent.navMeshObstacle.enabled = false;

            yield return null;

            yield return null;

            motionAgent.navMeshAgent.enabled = true;
            Instance.map.Add(subject.GetHashCode(), motionAgent);
        }

        //Instance.agentList.Add(motionAgent);

        motionAgent.isStop = false;
        motionAgent.navMeshAgent.SetDestination(targetPoint);
        yield return null;
        Debug.Log(motionAgent.navMeshAgent.remainingDistance);
        yield return motionAgent;
    }
开发者ID:exolution,项目名称:cosmic-editor,代码行数:38,代码来源:MotionController.cs

示例8: GameEntityCacheEntry

        /// <summary>
        /// Creates this cache entry
        /// Automatically gets reference to the EntityTag of the Entity
        /// </summary>
        /// <param name="Entity">GameEntity to cache</param>
        public GameEntityCacheEntry(GameObject Entity)
        {
            if(Entity.tag != "GameEntity")
            {
                Debug.LogError("Attempted to cache a non GameEntity GameObject. Blocked");
                Entity = null;
                Tag = null;
            }

            this.Entity = Entity;

            Tag = Entity.GetComponent<EntityTag>();

            EntityHash = Entity.GetHashCode();
        }
开发者ID:IsaacOfModels,项目名称:Installation01,代码行数:20,代码来源:GameEntityCacheEntry.cs

示例9: updateObjectPosition

    public void updateObjectPosition(GameObject obj)
    {
        GridData data = objectToGridData[obj.GetHashCode()];

        // Remove old weight from old positions
        this.updateGrid(data.fromX, data.fromY, data.toX, data.toY, -data.cost);

        // calculate new positions
        var width = data.toX - data.fromX;
        var height = data.toY - data.fromY;
        getGridCoords(obj.transform.position.x + data.xOffset - width/2, obj.transform.position.y + data.yOffset - height/2, out data.fromX, out data.fromY);
        getGridCoords(obj.transform.position.x + data.xOffset + width/2, obj.transform.position.y + data.yOffset + height/2, out data.toX, out data.toY);

        // update map
        objectToGridData[obj.GetHashCode()] = data;

        // Add weight to new positions
        this.updateGrid(data.fromX, data.fromY, data.toX, data.toY, -data.cost);

        //Debug.Log(string.Format("{0} at ({1},{2}) ({3}, {4})", obj.GetHashCode(), data.fromX, data.fromY, data.toX, data.toY));
    }
开发者ID:Ralusama19,项目名称:StudentsVsZombies,代码行数:21,代码来源:SceneGridManager.cs

示例10: HasGameObjectInHeirarchy

    private bool HasGameObjectInHeirarchy(GameObject gameObject, int hashCodeToSearchFor)
    {
        if (gameObject.GetHashCode() == hashCodeToSearchFor)
            return true;

        foreach (Transform child in gameObject.transform)
        {
            if (HasGameObjectInHeirarchy(child.gameObject, hashCodeToSearchFor))
                return true;
        }

        return false;
    }
开发者ID:TreyWheeler,项目名称:ProjectLilith,代码行数:13,代码来源:ClickTracker.cs

示例11: EvalutateOnOutsideClick

    private void EvalutateOnOutsideClick(GameObject gameObjectBeingClicked)
    {
        int hashOfClickedItem = gameObjectBeingClicked.GetHashCode();

        foreach (var kvp in _onOutsideClickHandlers)
        {
            // Create a strong reference to this variable so that it can't be collected after "HasExpired" evalutes
            var gameObject = kvp.Value.GameObject;

            if (!kvp.Value.HasExpired && !HasGameObjectInHeirarchy(gameObject, hashOfClickedItem))
            {
                kvp.Value.Execute();
            }
        }
    }
开发者ID:TreyWheeler,项目名称:ProjectLilith,代码行数:15,代码来源:ClickTracker.cs

示例12: RemoveSubject

	/// <summary>
	/// Removes a GameObject as a subjects of
	/// this panel's transitions.
	/// </summary>
	/// <param name="go">GameObject to be removed as a subject.</param>
	public void RemoveSubject(GameObject go)
	{
		int hash = go.GetHashCode();

		if (!subjects.ContainsKey(hash))
			return;

		subjects.Remove(hash);

		for (int i = 0; i < Transitions.list.Length; ++i)
			Transitions.list[i].RemoveSubSubject(go);

		// Remove the subject from any parent container as well:
		if (container != null)
			container.RemoveSubject(go);
	}
开发者ID:juliancruz87,项目名称:transpp,代码行数:21,代码来源:UIPanelBase.cs

示例13: AddSubject

	/// <summary>
	/// Adds a GameObject as a subject of this
	/// panel's transitions.
	/// </summary>
	/// <param name="go">GameObject to be added as a subject.</param>
	public void AddSubject(GameObject go)
	{
		int hash = go.GetHashCode();

		if (subjects.ContainsKey(hash))
			return;

		subjects.Add(hash, go);

		for (int i = 0; i < Transitions.list.Length; ++i)
			Transitions.list[i].AddSubSubject(go);

		// Add the subject to any parent container as well:
		if (container != null)
			container.AddSubject(go);
	}
开发者ID:juliancruz87,项目名称:transpp,代码行数:21,代码来源:UIPanelBase.cs

示例14: RemoveSubject

	/// <summary>
	/// Removes a GameObject as a subjects of
	/// this panel's transitions.
	/// </summary>
	/// <param name="go">GameObject to be removed as a subject.</param>
	public void RemoveSubject(GameObject go)
	{
		int hash = go.GetHashCode();

		if (!subjects.ContainsKey(hash))
			return;

		subjects.Remove(hash);

		for (int i = 0; i < Transitions.list.Length; ++i)
			Transitions.list[i].RemoveSubSubject(go);
	}
开发者ID:Nilesh410451,项目名称:archery-master,代码行数:17,代码来源:UIPanelBase.cs

示例15: add

 public static void add(GameObject gameObject,Unit unit)
 {
     unitMap.Add(gameObject.GetHashCode(), unit);
 }
开发者ID:exolution,项目名称:cosmic-editor,代码行数:4,代码来源:UnitManager.cs


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