コード例 #1
0
        public MainForm()
        {
            _stopwatchFrequency = Stopwatch.Frequency;
            _targetFrameTicks   = _stopwatchFrequency / _targetFramesPerSecond;

            InitializeComponent();

            _config = EmulatorConfig.Load();

            BuildMainMenu();
            SetFormStyles();

            _messagePump = new MessagePump();

            _audioDevice  = new AudioDevice(this.Handle);
            _soundEffects = LoadSoundEffects();

            _renderer      = new GdiRenderer(this);
            _displayBuffer = new DirectBitmap(_screenWidth, _screenHeight);
            _display       = new byte[0x1C00];

            _invaders = new SpaceInvaders(PlaySound);
            _input    = new InputState();

            InitializeOverlay();
        }
コード例 #2
0
 void Start()
 {
     SpaceInvaders.SetDefault();
     if (SpaceInvaders.drawBackground)
     {
         background = Instantiate(background);
         StartCoroutine(SpriteChanger());
     }
 }
コード例 #3
0
        public List <Vaisseau> Utilise(List <Vaisseau> listEnnemies)
        {
            if (EstDetruit())
            {
                return(listEnnemies);
            }

            if (SpaceInvaders.CountAlive(listEnnemies) == 0)
            {
                Console.WriteLine("## BTOOOM !! ##");
                SpaceInvaders.Instance.allPlayers[0].vaisseau.Endommage(10);
                this.Endommage(15);
            }

            return(listEnnemies);
        }
コード例 #4
0
    void Start()
    {
        SpaceInvaders.SetDefault();
        if (SpaceInvaders.lightingEffects)
        {
            block.GetComponent <SpriteRenderer>().material = lightingMaterial;
        }
        else
        {
            block.GetComponent <SpriteRenderer>().material = noLightingMaterial;
        }
        randomAppearing = new System.Random();
        float x = -6.6F, y = -2.25F;

        for (int k = 0; k < 4; k++)
        {
            for (int i = 0; i < 14; i++)
            {
                for (int j = 0; j < 20; j++)
                {
                    if (shelter[i, j] > 0)
                    {
                        GameObject thisBlock = Instantiate(block, new Vector3(x, y, 0), Quaternion.identity);
                        if (shelter[i, j] == 2 && SpaceInvaders.lightingEffects)
                        {
                            GameObject light = new GameObject("Light");
                            light.transform.SetParent(thisBlock.transform);
                            light.transform.position = thisBlock.transform.position + new Vector3(0, 0, -0.32F);
                            Light svet = light.AddComponent <Light>();
                            svet.range     = 5F;
                            svet.intensity = 0.8F;
                            svet.color     = new Color(0.133F, 0.694F, 0.298F, 1);

                            thisBlock.AddComponent <LightingShelter>();
                        }
                    }
                    x += 0.075F;
                }
                y -= 0.075F;
                x -= 20 * 0.075F;
            }
            x += 3.9F;
            y  = -2.25F;
        }
    }
コード例 #5
0
    void Start()
    {
        SpaceInvaders.SetDefault();
        if (SpaceInvaders.lightingEffects)
        {
            alien.GetComponent <SpriteRenderer>().material = lightingMaterial;
        }
        else
        {
            alien.GetComponent <SpriteRenderer>().material = noLightingMaterial;
        }

        moveDownAtStartAmount = 16 + SpaceInvaders.level;
        speed = 1;
        InstantiateAliens();
        DelayBetweenMoves = 0.01F;
        direction         = 1;
        time            = 0;
        countingAllowed = true;
        a = new System.Random();
        bulletSpawnTime = a.Next(2, 9) / 10F;
    }
コード例 #6
0
 public void CallSettings()
 {
     SceneManager.LoadSceneAsync("Settings Menu");
     SpaceInvaders.SetDefault();
 }
コード例 #7
0
    public override void Awake()
    {
        base.Awake();

        space_invaders = this;
    }
コード例 #8
0
ファイル: Program.cs プロジェクト: Vibee07/SpaceInvaders
 static void Main()
 {
     using (var game = new SpaceInvaders())
         game.Run();
 }