⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 team.java

📁 thq 发布的《worms》 motorola 源代码
💻 JAVA
字号:
import javax.microedition.lcdui.Graphics;

public class Team
{

    public Worm wormListHuman[];
    public Worm wormListComputer[];
    public Worm wormList[];
    private int currentActiveWorm;
    private static int curWormName = 0;
    public boolean redTeam;
    public boolean humanTeam;
    private int teamNo;

    public Team(boolean flag, int i, int j)
    {
        currentActiveWorm = 0;
        teamNo = i;
        redTeam = flag;
        wormListHuman = new Worm[j];
        wormListComputer = new Worm[j];
        for(int k = 0; k < j; k++)
        {
            wormListHuman[k] = new Worm(flag, i, false);
            wormListComputer[k] = new ComputerWorm(flag, i, true);
        }

    }

    public void reset(Game game, Landscape landscape, boolean flag)
    {
        humanTeam = flag;
        char c = '\0';
        if(teamNo == 0)
            c = '\257';
        if(flag)
            wormList = wormListHuman;
        else
            wormList = wormListComputer;
        
        System.out.println("===team===reset==41===c=="+(int)c);
        for(int i = 0; i < wormList.length; i++)
            wormList[i].reset(game, landscape, c + (i + 1) * 30);

    }

    public void resetHealthCountDown()
    {
        for(int i = 0; i < wormList.length; i++)
            wormList[i].healthCountDown = -1;

    }

    public void runFrame()
    {
        for(int i = 0; i < wormList.length; i++) {
        	//System.out.println("===team====i==="+i);
            wormList[i].runFrame();
        }
    }

    public void endTurn()
    {
        wormList[currentActiveWorm].endTurn();
    }

    public boolean isDead()
    {
        boolean flag = true;
        for(int i = 0; i < wormList.length; i++)
            if(!wormList[i].isDead())
                flag = false;

        return flag;
    }

    public void activateNextWorm()
    {
        do
        {
            currentActiveWorm++;
            currentActiveWorm %= wormList.length;
        } while(wormList[currentActiveWorm].isDead());
        wormList[currentActiveWorm].activate();
    }

    public Worm getActiveWorm()
    {
        return wormList[currentActiveWorm];
    }

    public void keyReleased(int i)
    {
        for(int j = 0; j < wormList.length; j++)
            wormList[j].keyReleased(i);

    }

    public void keyPressed(int i)
    {
        for(int j = 0; j < wormList.length; j++)
            wormList[j].keyPressed(i);

    }

    public void paint(Graphics g)
    {
        for(int i = 0; i < wormList.length; i++)
            if(i != currentActiveWorm)
                wormList[i].paint(g);

        wormList[currentActiveWorm].paint(g);
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -