Пример #1
0
        // 初期配置に盤面をリセットする関数reset
        // 開発途中用
        private void reset()
        {
            // サイズのリセットを行う
            ghost11.Width = 50; ghost11.Height = 50;
            ghost12.Width = 50; ghost12.Height = 50;
            ghost13.Width = 50; ghost13.Height = 50;
            ghost14.Width = 50; ghost14.Height = 50;
            ghost15.Width = 50; ghost15.Height = 50;
            ghost16.Width = 50; ghost16.Height = 50;
            ghost17.Width = 50; ghost17.Height = 50;
            ghost18.Width = 50; ghost18.Height = 50;

            ghost21.Width = 50; ghost21.Height = 50;
            ghost22.Width = 50; ghost22.Height = 50;
            ghost23.Width = 50; ghost23.Height = 50;
            ghost24.Width = 50; ghost24.Height = 50;
            ghost25.Width = 50; ghost25.Height = 50;
            ghost26.Width = 50; ghost26.Height = 50;
            ghost27.Width = 50; ghost27.Height = 50;
            ghost28.Width = 50; ghost28.Height = 50;

            // 配置のリセットを行う
            GhostType[,] reset = new GhostType[6, 6]
            {
                { GhostType.Blank, GhostType.P2evil, GhostType.P2evil, GhostType.P2evil, GhostType.P2evil, GhostType.Blank },
                { GhostType.Blank, GhostType.P2good, GhostType.P2good, GhostType.P2good, GhostType.P2good, GhostType.Blank },
                { GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank },
                { GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank },
                { GhostType.Blank, GhostType.P1good, GhostType.P1good, GhostType.P1good, GhostType.P1good, GhostType.Blank },
                { GhostType.Blank, GhostType.P1evil, GhostType.P1evil, GhostType.P1evil, GhostType.P1evil, GhostType.Blank }
            };

            display(reset);
        }
Пример #2
0
    //****************
    //Public Class varibles
    //****************
    //public int GHOST_HEIGHT { get => this._GHOST_HEIGHT; }
    //public int GHOST_WIDTH { get => this._GHOST_WIDTH; }
    //public int X { get => this._X; }
    //public int Y { get => this._Y; }
    //public bool isAlive { get => this._isAlive; }
    //public GhostType ghostType { get => this._ghostType; }
    //public Direction characterDirection { get => this._characterDirection; }
    //public Speed speed { get => this._speed; }
    //public bool isFacingBlock { get => this._isFacingBlock; }

    //****************
    //Initializations
    //****************

    /// <summary>
    /// Initialize the dot object
    /// </summary>
    /// <param name="height">"The height of the ghost."</param>
    /// <param name="width">"The width of the ghost."</param>
    /// <param name="X">"The X position of the ghost."</param>
    /// <param name="Y">"The Y position of the ghost."</param>
    /// <param name="d">"The direction the ghost should be facing."</param>
    /// <param name="gType">"The type of ghost."</param>

    public Ghost(int height, int width, int X, int Y, Direction d, GhostType gType)
    {
        this._ghostType = gType;
        setX(X);
        setY(Y);
        setDirection(d);
    }
Пример #3
0
 public Ghost(string id, Color color, int direction, int speed, int size, GhostType ghostType) : base(id, size)
 {
     Color     = color;
     Direction = direction;
     Speed     = speed;
     GhostType = ghostType;
 }
Пример #4
0
 public Ghost(GhostType type, EvidenceType evidence, EvidenceType absoluteEvidence = EvidenceType.None)
 {
     Type             = type;
     State            = GhostState.Potential;
     RequiredEvidence = evidence;
     AbsoluteEvidence = absoluteEvidence;
 }
Пример #5
0
 protected GhostAIBehavior(GhostObject owner, PacmanObject target, Maze level, GhostType type)
 {
     this.owner  = owner;
     this.target = target;
     this.level  = level;
     this.type   = type;
 }
Пример #6
0
    public static GhostBehavior Create(GhostType type, Ghost ghost)
    {
        GhostBehavior ghostBehavior = null;

        switch (type)
        {
        case GhostType.shadow:
            ghostBehavior = new Shadow(ghost);
            break;

        case GhostType.speedy:
            ghostBehavior = new Speedy(ghost);
            break;

        case GhostType.bashful:
            ghostBehavior = new Bashful(ghost);
            break;

        case GhostType.pokey:
            ghostBehavior = new Pokey(ghost);
            break;
        }

        return(ghostBehavior);
    }
Пример #7
0
        public static GhostObject CreateObject(TFID id, GhostType type)
        {
            Console.WriteLine("GhostObject::CreateObject");
            GhostObject obj;

            switch (type)
            {
                case GhostType.Creature:
                    obj = new GhostCreature();
                    break;

                case GhostType.Vehicle:
                    obj = new GhostVehicle();
                    break;

                case GhostType.Character:
                    obj = new GhostCharacter();
                    break;

                case GhostType.Object:
                    obj = new GhostObject();
                    break;

                default:
                    throw new ArgumentException("Could not create GhostObject for not existing type!", "type");
            }

            obj.Guid = id;
            return obj;
        }
Пример #8
0
    private Vector2 ComputeTarget(GhostType ghost)
    {
        switch (ghost)
        {
        case GhostType.Blinky:
            return(target.position);

        case GhostType.Pinky:
            switch (target.lastDir)
            {
            case MoveDir.Up:
                return(new Vector2(target.position.x - 4, target.position.y - 4));

            case MoveDir.Down:
                return(new Vector2(target.position.x, target.position.y + 4));

            case MoveDir.Left:
                return(new Vector2(target.position.x - 4, target.position.y));

            case MoveDir.Right:
                return(new Vector2(target.position.x + 4, target.position.y));

            default:
                return(target.position);
            }

        case GhostType.Inky:
            Vector2 tempTarget;
            switch (target.lastDir)
            {
            case MoveDir.Up:
                tempTarget = new Vector2(target.position.x - 2, target.position.y - 2);
                break;

            case MoveDir.Down:
                tempTarget = new Vector2(target.position.x, target.position.y + 2);
                break;

            case MoveDir.Left:
                tempTarget = new Vector2(target.position.x - 2, target.position.y);
                break;

            case MoveDir.Right:
                tempTarget = new Vector2(target.position.x + 2, target.position.y);
                break;

            default:
                tempTarget = target.position;
                break;
            }
            return(tempTarget + (tempTarget - blinky.position));

        case GhostType.Clyde:
            return(Vector2.Distance(position, target.position) < 8 ? ScatterTarget(type) : target.position);

        default:
            return(target.position);
        }
    }
Пример #9
0
 public Ghost(GhostType type, Pos pos, Pos?corner)
 {
     this.type   = type;
     this.pos    = pos;
     this.corner = corner ?? pos;
     origin      = pos;
     pauseTime   = GhostSpawnPauseTime[(int)type];
 }
Пример #10
0
        public Ghost(GhostType type)
            : base("the Ghost")
        {
            GumpCliloc = (int)type;

            _Timer = new InternalTimer(this);
            _Timer.Start();
        }
Пример #11
0
Файл: Ghost.cs Проект: elken/A2
 public Ghost(Vector2 currentPosition, Vector2 velocity, World world, GhostType type)
     : base(currentPosition, velocity, world)
 {
     CurrentPosition = currentPosition;
     this.size       = new Vector2(35, 60);
     this.hitBox     = new Rectangle((int)(CurrentPosition.X), (int)(CurrentPosition.Y), (int)size.X, (int)size.Y);
     this.baseSpeed  = 2f;
     this.type       = type;
 }
Пример #12
0
 //Initialise Ghost and set type
 public void ghostInit(GridIndex index, GameController controller, GhostType type)
 {
     this.index      = index;
     this.controller = controller;
     this.type       = type;
     isMoving        = false;
     multiplier      = (type == GhostType.SLOW) ? controller.SLOWGHOST_SPEED_MULTIPLIER : controller.FASTGHOST_SPEED_MULTIPLIER;
     speed           = controller.BASE_SPEED * multiplier; //Adjust Speed based on type of ghost
     target          = new GridIndex();
     StartCoroutine("findTarget");
 }
Пример #13
0
    public void spawnGhost(GhostType type)
    {
        switch (type)
        {
        case (GhostType.Rojo):
            break;

        case (GhostType.Purpura):
            break;
        }
    }
Пример #14
0
        public void SetGhostType(GhostType type)
        {
            ghostType = type;

            //Debug.Log((int)type);
            // Change its color
            SetGhostColor(ghostMaterials[(int)type]);

            // Change its name
            name = System.Enum.GetName(typeof(GhostType), type);
        }
Пример #15
0
        // テスト用ボタン2(表示テスト)のクリック時処理の記述
        // 開発途中用
        private void bt_test2_Click(object sender, RoutedEventArgs e)
        {
            GhostType[,] test = new GhostType[6, 6]
            {
                { GhostType.Blank, GhostType.P2evil, GhostType.Blank, GhostType.P2evil, GhostType.Blank, GhostType.Blank },
                { GhostType.Blank, GhostType.Blank, GhostType.P2good, GhostType.Blank, GhostType.P2good, GhostType.Blank },
                { GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank },
                { GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank, GhostType.Blank },
                { GhostType.Blank, GhostType.P1good, GhostType.Blank, GhostType.P1good, GhostType.P1good, GhostType.Blank },
                { GhostType.Blank, GhostType.P1evil, GhostType.Blank, GhostType.P1evil, GhostType.P1evil, GhostType.Blank }
            };

            display(test);
        }
Пример #16
0
 internal GhostObject(GraphicsHandler handler, GhostType type, PacmanObject target, Maze level)
     : base(GraphicsConstants.SpriteSize)
 {
     normalPalette = type.ToPalette();
     sprite        = new GhostSprite()
     {
         Palette = normalPalette
     };
     handler.Register(this, sprite);
     Behavior = GhostAIBehavior.FromGhostType(type, this, target, level);
     State    = new GhostHomeState(this);
     PerformTurn(Direction.Down);
     Velocity = Vector2.Zero;
 }
Пример #17
0
 //Evil,Evil...Goodの順に並んでいるリストを Good,Good...Evilの順に並び替える
 //その過程ですべての順列を列挙する
 public static bool NextPermutation(List <GhostType> dst)
 {
     for (int i = dst.Count - 1; i >= 1; i--)
     {
         GhostType left  = dst[i - 1];
         GhostType right = dst[i];
         if (left == GhostType.Evil && right == GhostType.Good)
         {
             dst[i - 1] = GhostType.Good;
             dst[i]     = GhostType.Evil;
             return(true);
         }
     }
     return(false);
 }
Пример #18
0
        public Ghost GetGhost(GhostType aGhostType, Player aPlayer, GameBoard aGameBoard, Vector2 aPosition)
        {
            switch (aGhostType)
            {
            case GhostType.Red:
                return(new RedGhost(aPlayer, aGameBoard, aPosition));

            case GhostType.Blue:
                return(new BlueGhost(aPlayer, aGameBoard, aPosition));

            case GhostType.Violet:
                return(new VioletGhost(aPlayer, aGameBoard, aPosition));

            case GhostType.Orange:
                return(new OrangeGhost(aPlayer, aGameBoard, aPosition));
            }
            return(null);
        }
Пример #19
0
        internal static PaletteID ToPalette(this GhostType type)
        {
            switch (type)
            {
            case GhostType.Blinky:
                return(PaletteID.Blinky);

            case GhostType.Pinky:
                return(PaletteID.Pinky);

            case GhostType.Inky:
                return(PaletteID.Inky);

            case GhostType.Clyde:
                return(PaletteID.Clyde);

            default:
                throw new Exception("Unhandled AI type.");
            }
        }
Пример #20
0
    public List <Transform> GetWaypoints(GhostType type)
    {
        switch (type)
        {
        case GhostType.Blinky:
            return(getChildren("BlinkyWaypoints"));

        case GhostType.Inky:
            return(getChildren("InkyWaypoints"));

        case GhostType.Pinky:
            return(getChildren("PinkyWaypoints"));

        case GhostType.Clyde:
            return(getChildren("ClydeWaypoints"));

        default:
            return(new List <Transform>());
        }
    }
Пример #21
0
    //Returns scatter targets for a given ghost type
    private Vector2 ScatterTarget(GhostType ghost)
    {
        switch (ghost)
        {
        case GhostType.Blinky:
            return(new Vector2(LevelParser.mapWidth, 0));

        case GhostType.Pinky:
            return(new Vector2(0, 0));

        case GhostType.Inky:
            return(new Vector2(LevelParser.mapWidth, LevelParser.mapHeight));

        case GhostType.Clyde:
            return(new Vector2(0, LevelParser.mapHeight));

        default:
            return(new Vector2(LevelParser.mapWidth / 2, LevelParser.mapHeight / 2));
        }
    }
Пример #22
0
        internal static AIBehavior FromGhostType(GhostType type, GhostObject owner, PacmanObject target, Maze level)
        {
            switch (type)
            {
            case GhostType.Blinky:
                return(new BlinkyAIBehavior(owner, target, level));

            case GhostType.Pinky:
                return(new PinkyAIBehavior(owner, target, level));

            case GhostType.Inky:
                return(new InkyAIBehavior(owner, target, level));

            case GhostType.Clyde:
                return(new ClydeAIBehavior(owner, target, level));

            default:
                throw new Exception("Unhandled ghost AI.");
            }
        }
Пример #23
0
    public void SetGhost(Vector3 position, GhostType type)
    {
        Ghost   ghost = Instantiate(ghostPrefab, ghostsHolder);
        Vector3 pos   = position;
        Vector2 pos2D = Region.ClosestPoint(position.XZ());

        pos.x = pos2D.x;
        pos.z = pos2D.y;
        ghost.transform.position = pos;
        ghost.type = type;
        if (IsBossMode)
        {
            ghost.Rebirth(3f);
            Add(ghost, fixedGhosts);
        }
        else
        {
            ghost.MoveOut();
            Add(ghost, moveOutGhosts);
        }
    }
Пример #24
0
    Vector2 GetGhostTargetTile(GhostType m)
    {
        // four head of pcman
        // taking account position and orientation
        Vector2 targetTile  = Vector2.zero;
        Vector2 pacManOrien = pacMan.GetComponent <PacMan>().orientation;
        int     posX        = Mathf.RoundToInt(pacMan.transform.localPosition.x);
        int     posY        = Mathf.RoundToInt(pacMan.transform.localPosition.y);
        Vector2 pacManTile  = new Vector2(posX, posY);

        if (m == GhostType.Pink)
        {
            targetTile = pacManTile + (4 * pacManOrien);
        }
        else if (m == GhostType.Blue)
        {
            targetTile = pacManTile + (2 * pacManOrien);
            Vector2 tempRedGhostPos = GameObject.Find("redGhost").transform.localPosition;
            tempRedGhostPos = new Vector2(tempRedGhostPos.x, tempRedGhostPos.y);
            float distance = GetDistance(tempRedGhostPos, targetTile);
            distance   = distance * 2;
            targetTile = new Vector2(tempRedGhostPos.x + distance, tempRedGhostPos.y + distance);
        }
        else if (m == GhostType.Orange)
        {
            float distance = GetDistance(transform.localPosition, pacMan.transform.localPosition);
            if (distance > 0)
            {
                targetTile = new Vector2(posX, posY);
            }
            else
            {
                targetTile = homeNode.transform.position;
            }
        }

        return(targetTile);
    }
Пример #25
0
        public Ghost(int x, int y, Colors color, GhostType nickname, Pacman pack, Direction direction = Direction.DOWN)
        {
            eatenPlayer = new SoundPlayer();
            eatenPlayer.SoundLocation = Environment.CurrentDirectory + @"\pacman_eatghost.wav";

            _x         = x;
            _y         = y;
            _color     = color;
            _ghosts    = new Dictionary <int, string[]>();
            _ghosts[0] = _ghost0;
            _ghosts[1] = _ghost1;
            _ghosts[2] = _ghost2;
            _ghosts[3] = _ghost3;

            _animation      = 0;
            _animationtimer = 0;
            _animationSpeed = 15;

            _moveTimer = 0;
            _moveSpeed = 2;

            _stateTimer     = 0;
            _stateFrequency = 120;
            _direction      = direction;

            _targetTimer     = 0;
            _targetFrequency = 180;

            _frightenedTimer    = 0;
            _frightenedDuration = 240;

            state = GhostState.Scatter;

            _nickname = nickname;
            _pack     = pack;
            target.x  = _x;
            target.y  = _y;
        }
Пример #26
0
        public Ghost(GhostType t)
        {
            lastDir.X = 0;
            lastDir.Y = 0;
            tex = null;
            type = t;

            switch (t)
            {
                case GhostType.Blinky:
                    scatterLoc.Y = 0;
                    scatterLoc.X = 26;

                    loc.Y = 116;
                    loc.X = 116;

                    startLoc.Y = 144;
                    startLoc.X = 116;

                    mode = GhostMode.Running;
                    startMode = GhostMode.OutPen;
                    break;

                case GhostType.Inky:
                    scatterLoc.Y = 35;
                    scatterLoc.X = 26;

                    startLoc.Y = loc.Y = 144;
                    startLoc.X = loc.X = 128;

                    mode = GhostMode.Pen;
                    startMode = GhostMode.Pen;
                    break;

                case GhostType.Pinky:
                    scatterLoc.Y = 0;
                    scatterLoc.X = 2;

                    startLoc.Y = loc.Y = 144;
                    startLoc.X = loc.X = 116;

                    mode = GhostMode.OutPen;
                    startMode = GhostMode.Pen;
                    break;

                case GhostType.Clyde:
                    scatterLoc.Y = 35;
                    scatterLoc.X = 0;

                    startLoc.Y = loc.Y = 144;
                    startLoc.X = loc.X = 100;

                    mode = GhostMode.Pen;
                    startMode = GhostMode.Pen;
                    break;
            }
        }
Пример #27
0
        public Ghost()
        {
            loc.Y = 40;
            loc.X = 16;

            lastDir.X = 0;
            lastDir.Y = 0;
            tex = null;
            type = GhostType.Blinky;

            scatterLoc.Y = 4;
            scatterLoc.X = 204;

            mode = GhostMode.Pen;
        }
Пример #28
0
        /// <summary>
        /// Draws ghosted objects over timeline display during move and resize operations</summary>
        /// <param name="ghosts">Ghosted timeline objects</param>
        /// <param name="type">Type of ghosts to draw</param>
        /// <param name="transform">Transform taking timeline objects to display coordinates</param>
        /// <param name="clientRectangle">Bounds of displayed area of timeline, in screen space</param>
        public void DrawGhosts(
            ICollection<GhostInfo> ghosts,
            GhostType type,
            Matrix transform,
            Rectangle clientRectangle)
        {
            Context c = new Context(this, transform, clientRectangle, m_graphics);

            RectangleF oldClipBounds = c.Graphics.ClipBounds;
            RectangleF clipBounds = new RectangleF(
                oldClipBounds.X + HeaderWidth,
                oldClipBounds.Y,
                oldClipBounds.Width - HeaderWidth,
                oldClipBounds.Height);
            try
            {
                m_graphics.PushAxisAlignedClip(clipBounds);

                DrawMode drawModeFlags = 0;
                if (type == GhostType.ResizeLeft)
                    drawModeFlags |= DrawMode.ResizeLeft;
                if (type == GhostType.ResizeRight)
                    drawModeFlags |= DrawMode.ResizeRight;

                foreach (GhostInfo ghost in ghosts)
                {
                    DrawMode drawMode = ghost.Valid ? DrawMode.Ghost : DrawMode.Invalid;
                    drawMode |= drawModeFlags;

                    IInterval interval = ghost.Object as IInterval;
                    if (interval != null)
                    {
                        Draw(interval, ghost.Bounds, drawMode, c);
                        continue;
                    }

                    ITimelineReference reference = ghost.Object as ITimelineReference;
                    if (reference != null)
                    {
                        // until we get the local-to-world transform put in
                        DrawTimelineReference(reference, ghost.Bounds, drawMode, c);
                        continue;
                    }

                    IKey key = ghost.Object as IKey;
                    if (key != null)
                    {
                        Draw(key, ghost.Bounds, drawMode, c);
                        continue;
                    }

                    IMarker marker = ghost.Object as IMarker;
                    if (marker != null)
                    {
                        Draw(marker, ghost.Bounds, drawMode, c);
                        continue;
                    }

                    ITrack track = ghost.Object as ITrack;
                    if (track != null)
                    {
                        Draw(track, ghost.Bounds, drawMode, c);
                        continue;
                    }

                    IGroup group = ghost.Object as IGroup;
                    if (group != null)
                    {
                        Draw(group, ghost.Bounds, drawMode, c);
                        continue;
                    }
                }
            }
            finally
            {
                m_graphics.PopAxisAlignedClip();
            }
        }
Пример #29
0
 public static Ghost Create(int teamId, GhostType type)
 {
     return(sGhosts[teamId, (int)type]);
 }
Пример #30
0
 public Ghost(GhostType type)
     : base("the Ghost")
 {
     GumpCliloc = (int)type;
 }
Пример #31
0
 public Ghost(int teamNo, GhostType type)
 {
     this.mTeamNo = teamNo;
     this.mType   = type;
 }
Пример #32
0
 public string GetWikiLinkFor(GhostType ghostType) =>
 ghostType switch
 {
Пример #33
0
 // --- 以下、余ったゴースト(GhostType:gt) n体を盤外に配置する関数 ---
 private void set31(GhostType gt, int n)
 {
     if (n > 0)
     {
         if (gt == GhostType.P1good)
         {
             set14(460, -120);
         }
         if (gt == GhostType.P1evil)
         {
             set18(460, -60);
         }
         if (gt == GhostType.P2good)
         {
             set24(460, 40);
         }
         if (gt == GhostType.P2evil)
         {
             set28(460, 100);
         }
     }
     if (n > 1)
     {
         if (gt == GhostType.P1good)
         {
             set13(480, -120);
         }
         if (gt == GhostType.P1evil)
         {
             set17(480, -60);
         }
         if (gt == GhostType.P2good)
         {
             set23(480, 40);
         }
         if (gt == GhostType.P2evil)
         {
             set27(480, 100);
         }
     }
     if (n > 2)
     {
         if (gt == GhostType.P1good)
         {
             set12(500, -120);
         }
         if (gt == GhostType.P1evil)
         {
             set16(500, -60);
         }
         if (gt == GhostType.P2good)
         {
             set22(500, 40);
         }
         if (gt == GhostType.P2evil)
         {
             set26(500, 100);
         }
     }
     if (n > 3)
     {
         if (gt == GhostType.P1good)
         {
             set11(520, -120);
         }
         if (gt == GhostType.P1evil)
         {
             set15(520, -60);
         }
         if (gt == GhostType.P2good)
         {
             set21(520, 40);
         }
         if (gt == GhostType.P2evil)
         {
             set25(520, 100);
         }
     }
 }