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


C# Entity.GetEntityType方法代码示例

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


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

示例1: ValidateSelection

    public override bool ValidateSelection(Entity entity)
    {
        if (entity.GetEntityType() != "Tile")
            return false;

        Tile tile = entity as Tile;

        if (tile.Occupied)
            return false;

        if (!tile.Walkable)
            return false;

        Tile playerTile = character.currentTile;

        int xDif = Mathf.Abs(playerTile.X - tile.X);
        if (xDif > moveRange)
            return false;

        int yDif = Mathf.Abs(playerTile.Y - tile.Y);
        if (yDif > moveRange)
            return false;

        if ((xDif + yDif) > moveRange)
            return false;

        return character.GetActionPoints() > 0;
    }
开发者ID:TuckerBMorgan,项目名称:Slide,代码行数:28,代码来源:MoveAction.cs

示例2: OnSelctionAction

    public override void OnSelctionAction(Entity entity)
    {
        if (entity.GetEntityType() != "SlideCharacter") return;
        var slide = entity as SlideCharacter;
        if (slide.Team != team) return;

        if (selectedCharacter)
        {
            ConflictController.Instance.RemovePulseMaterial(selectedCharacter.GetComponent<Renderer>());
        }
        selectedCharacter = entity as SlideCharacter;

        AbilityButtonControl.Instance.ChangeSelectedCharacter(slide);
        GridController.DisplayMoveRange(selectedCharacter);

        ConflictController.Instance.AddPulseMaterial(selectedCharacter.Avatar.GetComponent<Renderer>());
    }
开发者ID:TuckerBMorgan,项目名称:Slide,代码行数:17,代码来源:PlayerController.cs

示例3: ValidateSelection

    public override bool ValidateSelection(Entity entity)
    {
        if (character.GetActionPoints() <= 0) return false;
        switch (targetType)
        {
            case TargetType.Character:
                if (entity.GetEntityType() != "SlideCharacter")
                {
                    return false;
                }

                SlideCharacter ch = entity as SlideCharacter;

                switch (targetFilter)
                {
                    case TargetFilter.Enemy:
                        if (ch.Team == character.Team) return false;
                        break;
                    case TargetFilter.Freindly:
                        if (ch.Team != character.Team) return false;
                        break;
                    default:

                        break;
                }

                break;
            case TargetType.Tile:
                if (entity.GetEntityType() != "Tile") return false;
                break;
            case TargetType.Either:
                if (entity.GetEntityType() != "Tile" && entity.GetEntityType() != "SlideCharacter") return false;
                break;
            case TargetType.Self:
                if (entity != character) return false;
                break;
            default:
                return false;
        }

        var tile = entity.getCurrentTile();
        int xDif = Mathf.Abs(tile.X - character.currentTile.X);
        if (xDif > range)
        {
            return false;
        }
        int yDif = Mathf.Abs(tile.Y - character.currentTile.Y);
        if (yDif > range)
        {
            return false;
        }
        int total = xDif + yDif;
        if (targetRange == TargetRange.Melee)
        {
            if (total > 2)
            {
                return false;
            }
        }
        else
        {
            if (total > (range * 2))
            {
                return false;
            }
        }
        return true;
    }
开发者ID:TuckerBMorgan,项目名称:Slide,代码行数:68,代码来源:SpellAction.cs

示例4: OnEntitySelection

    public bool OnEntitySelection(Entity entity)
    {
        if (entity.GetEntityType() == "Tile")
            currentAction = allowedActions["Move"];

        if (currentAction.ValidateSelection(entity) == false)
        {
            return false;
        }
        currentAction.PreformAction(entity);

        currentAction = fallbackAction;
        return true;
    }
开发者ID:TuckerBMorgan,项目名称:Slide,代码行数:14,代码来源:SlideCharacter.cs


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