Beispiel #1
0
        public Gel(float xPos, float yPos, Game1 game)
        {
            this.random = new System.Random();
            this.myGame = game;

            this.xPos     = xPos;
            this.initialX = xPos;
            this.yPos     = yPos;
            this.initialY = yPos;

            hitboxX = NpcTextureStorage.GEL_1.Width;
            hitboxY = NpcTextureStorage.GEL_1.Height;
            hitbox  = new Rectangle((int)xPos, (int)yPos, hitboxX, hitboxY);

            movementRNG = random.Next(1, 4);

            switch (movementRNG)
            {
            case 1:
                currentState = new GelWalkSouth(this);
                break;

            case 2:
                currentState = new GelWalkNorth(this);
                break;

            case 3:
                currentState = new GelWalkWest(this);
                break;

            case 4:
                currentState = new GelWalkEast(this);
                break;
            }
        }
Beispiel #2
0
        public Fireball()
        {
            currentState = new MiddleFireball(this, xPos, yPos, start);
            xPos         = 0;
            yPos         = 0;
            start        = false;

            hitboxX = NpcTextureStorage.BOSS_1.Height / 3;
            hitboxY = NpcTextureStorage.BOSS_1.Width / 3;
            hitbox  = new Rectangle((int)xPos, (int)yPos, hitboxX, hitboxY);
        }
Beispiel #3
0
        public GoriyaBoomerang()
        {
            currentState = new BoomerangDown(this, xPos, yPos, start);
            xPos         = 0;
            yPos         = 0;
            travelmarker = 0;
            start        = false;

            hitboxX = NpcTextureStorage.BOOMERANG_1.Width;
            hitboxY = NpcTextureStorage.BOOMERANG_1.Height;
            hitbox  = new Rectangle((int)xPos, (int)yPos, hitboxX, hitboxY);
        }
Beispiel #4
0
        public Boss(float xPos, float yPos, Fireball fireball1, Fireball fireball2, Fireball fireball3, Game1 game)
        {
            this.random   = new System.Random();
            this.myGame   = game;
            this.movement = false;

            health = 8;

            this.xPos = xPos;
            this.yPos = yPos;

            hitboxX = NpcTextureStorage.BOSS_1.Width;
            hitboxY = NpcTextureStorage.BOSS_1.Height;
            hitbox  = new Rectangle((int)xPos, (int)yPos, hitboxX, hitboxY);

            currentState = new BossWalkWest(this, fireball1, fireball2, fireball3);
        }
Beispiel #5
0
    public void PerformTransition(NpcTransition trans)
    {
        if (trans == NpcTransition.NullTansition)
        {
            Debug.LogError("要执行的转换条件为空 : " + trans); return;
        }
        NpcStateID nextStateID = mCurrentState.GetOutPutState(trans);

        if (nextStateID == NpcStateID.NullState)
        {
            Debug.LogError("在转换条件 [" + trans + "] 下,没有对应的转换状态"); return;
        }
        foreach (INpcState s in mStates)
        {
            if (s.stateID == nextStateID)
            {
                mCurrentState.DoBeforeLeaving();
                mCurrentState = s;
                mCurrentState.DoBeforeEntering();
                return;
            }
        }
    }
Beispiel #6
0
    public void AddState(INpcState state)
    {
        if (state == null)
        {
            Debug.LogError("要添加的状态为空"); return;
        }

        if (mStates.Count == 0)
        {
            mStates.Add(state);
            mCurrentState = state;
            mCurrentState.DoBeforeEntering();
            return;
        }

        foreach (INpcState s in mStates)
        {
            if (s.stateID == state.stateID)
            {
                Debug.LogError("要添加的状态ID[" + s.stateID + "]已经添加"); return;
            }
        }
        mStates.Add(state);
    }