示例#1
0
    //Get Walls That Block The Player In A Given Direction
    private int GetValidWallCount()
    {
        int total = 0;

        foreach (ColliderInfo ci in colliderInfos)
        {
            if (ci.tag == "Wall")
            {
                WallWalkScript wws = ci.gameObject.GetComponent <WallWalkScript>();
                if (wws != null)
                {
                    switch (moveDirection)
                    {
                    case MoveScripts.Direction.North: total += (wws.CanWalkNorth ? 0 : 1); break;

                    case MoveScripts.Direction.South: total += (wws.CanWalkSouth ? 0 : 1); break;

                    case MoveScripts.Direction.East: total += (wws.CanWalkEast ? 0 : 1); break;

                    case MoveScripts.Direction.West: total += (wws.CanWalkWest ? 0 : 1); break;
                    }
                }
                else
                {
                    total++;
                }
            }
        }
        return(total);
    }
示例#2
0
    public bool MoveBegin(Collider2D hit)
    {
        foundTrainer = false;
        if (hit == null)
        {
            return(true);
        }
        else
        {
            switch (hit.gameObject.tag)
            {
            default: return(true);

            case "Wall":
                wws = hit.gameObject.GetComponent <WallWalkScript>();
                if (wws != null)
                {
                    switch (move.lookDirection)
                    {
                    default: return(false);

                    case MoveScripts.Direction.North: return(wws.CanWalkNorth);

                    case MoveScripts.Direction.South: return(wws.CanWalkSouth);

                    case MoveScripts.Direction.East: return(wws.CanWalkEast);

                    case MoveScripts.Direction.West: return(wws.CanWalkWest);
                    }
                }
                else
                {
                    return(false);
                }

            case "Player":
                foundTrainer  = true;
                trainerObject = hit.gameObject;
                return(!engaged);

            case "Creature": return(false);

            case "Water": return(false);

            case "Trainer": return(hit.gameObject == this.gameObject);

            case "Thing": return(false);

            case "NPC": return(false);

            case "TrainerSight":
                return(true);

            case "Door":
                return(true);
            }
        }
    }