示例#1
0
        public void RemoveArrowType(Enums.Arrows type)
        {
            // Clear the appropriate token bit and remove the timer from the list of running timers
            types = Bitwise.ClearBit(types, (int)type);
            TokenTimer t = timers.Find(i => i.ID.Equals(type.ToString()));

            timers.Remove(t);
        }
示例#2
0
        // Removes the token from the types the player has collected
        private void RemoveToken(TokenTimer tt)
        {
            // Clear the appropriate token bit and remove the timer from the list of running timers
            types = Bitwise.ClearBit(types, (int)tt.TokenType);
            TokenTimer t = timers.Find(i => i.ID.Equals(tt.TokenType.ToString()));

            timers.Remove(t);
        }
示例#3
0
 /// <summary>
 /// Removes all active tokens from the player so shooting an arrow is only the normal arrow
 /// </summary>
 public void ClearAllTokens()
 {
     foreach (TokenTimer t in timers)
     {
         types = Bitwise.ClearBit(types, (int)t.TokenType);
         Destroy(t);
     }
     timers.Clear();
 }
示例#4
0
        private GameObject NewArrow()
        {
            GameObject newArrow = (GameObject)Instantiate(gameObject, transform.position, transform.rotation);

            newArrow.GetComponent <Rigidbody>().velocity = GetComponent <Rigidbody>().velocity;
            int types = GameManager.instance.GetPlayer(fromPlayer).ArcheryComponent.ArrowTypes;

            types = Bitwise.ClearBit(types, (int)Enums.Arrows.Splitting);
            newArrow.GetComponent <Arrows.ArrowController>().InitArrow(types, fromPlayer);
            return(newArrow);
        }
示例#5
0
文件: PPU.cs 项目: honased/GBSharp
 private void CheckLYC()
 {
     if (_gameboy.Mmu.LY == _gameboy.Mmu.LYC)
     {
         _gameboy.Mmu.STAT = Bitwise.SetBit(_gameboy.Mmu.STAT, 2);
         if (Bitwise.IsBitOn(_gameboy.Mmu.STAT, 6))
         {
             _gameboy.Mmu.SetInterrupt(Interrupts.LCDStat);
         }
     }
     else
     {
         _gameboy.Mmu.STAT = Bitwise.ClearBit(_gameboy.Mmu.STAT, 2);
     }
 }
示例#6
0
        public override void WriteRom(int address, int value)
        {
            switch (address)
            {
            case int _ when address < 0x2000:
                ERAMEnabled = ((value & 0x0F) == 0x0A);
                break;

            case int _ when address < 0x4000:
                BankRom = value & 0x1F;
                if (BankRom == 0x00 || BankRom == 0x20 || BankRom == 0x40 || BankRom == 0x60)
                {
                    BankRom++;
                }
                break;

            case int _ when address < 0x6000:
                if (CartridgeMode == 0)
                {
                    BankRom = (BankRom & 0x1F) | ((value & 0x03) << 5);
                }
                else
                {
                    BankRam = value & 0x03;
                }
                break;

            case int _ when address < 0x8000:
                CartridgeMode = value & 0x01;
                if (CartridgeMode == 0)
                {
                    BankRam = 0x00;
                }
                else
                {
                    BankRom = Bitwise.ClearBit(Bitwise.ClearBit(BankRom, 5), 6);
                }
                break;
            }
        }