Example #1
0
        public void Update(GameTime gametime)
        {
            //Assets Updaten
            finish = new Rectangle(14, 700, 100, 180);
            bigRec = new Rectangle(0, 0, 1750, 300);
            liftobject.Update(gametime);

            mist_speed   -= 0.25f;
            wolken_speed -= 0.20f;
            for (int i = 0; i < plates.Count; i++)
            {
                if (plates[0].pressed == true && plates[1].pressed == true)
                {
                    liftobject.position.Y = 800;
                }
            }

            for (int i = 0; i < stones.Count; i++)
            {
                Steen steen = stones[i];
                steen.Update(gametime);
                //steen.UpdateAnimation(gametime);
                if (steen.Crushed)
                {
                    stones.Remove(steen);
                    i--;
                }
            }

            for (int k = 0; k < doors.Count; k++)
            {
                Door door = doors[k];
                if (door.open)
                {
                    doors.Remove(door);
                    k--;
                }
            }

            for (int j = 0; j < collectibles.Count; j++)
            {
                CollectItem item = collectibles[j];
                item.UpdateAnimation(gametime);
                if (item.pickedUp)
                {
                    collectibles.Remove(item);
                    j--;
                }
            }

            foreach (Ladder ladder in ladders)
            {
                ladder.Update(gametime);
            }

            foreach (MoveDoor door in Mdoors)
            {
                door.Update(gametime);
            }
        }
Example #2
0
 void Start()
 {
     projectile    = projectile.GetComponent <Rigidbody> ();
     shootingPower = 150;
     collect       = GameObject.Find("First Person Controller").GetComponent <CollectItem> ();
     inventory     = GameObject.Find("First Person Controller").GetComponent <Inventory>();
 }
Example #3
0
 void Start()
 {
     rockProjectile = rockProjectile.GetComponent <Rigidbody> ();
     throwingPower  = 20;
     inventory      = GameObject.Find("First Person Controller").GetComponent <Inventory>();
     collect        = GameObject.Find("First Person Controller").GetComponent <CollectItem> ();
 }
Example #4
0
 void Start()
 {
     thrownTime             = Time.realtimeSinceStartup;
     collect                = GameObject.Find("First Person Controller").GetComponent <CollectItem> ();
     inventory              = GameObject.Find("First Person Controller").GetComponent <Inventory> ();
     echoSpherez            = GameObject.Find("First Person Controller").GetComponent <EchoSpherez> ();
     echoSpherez.isGrounded = true;
 }
Example #5
0
    // Use this for initialization
    void Awake()
    {
        collectItem = GameObject.FindGameObjectWithTag("Plant").GetComponent<CollectItem>();

        int i = Random.Range(1, 9);
        if (i <= 2)
            gameObject.SetActive(false);
        if (i > 2 && i <= 7)
            gameObject.SetActive(true);
        if (i > 7)
            gameObject.SetActive(false);
    }
Example #6
0
 void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.gameObject.tag == "Collectible")
     {
         CollectItem itemInfo = collision.gameObject.GetComponent <CollectItem>();
         gameManager.setPoints(itemInfo.GetPoints());
     }
     else if (collision.gameObject.tag == "Boundary")
     {
         gameManager.setGameState("Game Over");
     }
     else
     {
         Debug.Log("Collsion unhandled at: " + collision.gameObject.name + " With tag: " + collision.gameObject.tag);
     }
 }
Example #7
0
    void Start()
    {
        oldMan           = GameObject.Find("OldMan");
        hG               = GameObject.Find("HospitalGirl");
        eyesHere         = GameObject.Find("EyesHere");
        cam              = GameObject.Find("Main Camera");
        activationSwitch = GameObject.Find("Activation Switch");

        tr          = transform;
        enemyDamage = GameObject.Find("HospitalGirl").GetComponent <HospitalGirl> ();
        wander      = GameObject.Find("OldMan").GetComponent <Wander> ();
        inventory   = GetComponent <Inventory> ();
        environment = GameObject.Find("Environment").GetComponent <Environmental>();
        collect     = GameObject.Find("First Person Controller").GetComponent <CollectItem> ();
        chMotor     = GetComponent <CharacterMotorC>();
        ch          = GetComponent <CharacterController>();
        dist        = ch.height / 2; // calculate distance to ground
    }
Example #8
0
    void Start()
    {
        for (int i = 0; i < (slotsX * slotsY); i++)
        {
            slots.Add(new Item());
            inventory.Add(new Item());
        }
        holdingKey         = GameObject.Find("HoldingKey");
        holdingGun         = GameObject.Find("HoldingGun");
        holdingGloves      = GameObject.FindGameObjectsWithTag("Gloves");
        holdingRock        = GameObject.Find("HoldingRock");
        holdingPoisonHead  = GameObject.Find("HoldingPoisonHead");
        holdingAnatomy     = GameObject.Find("HoldingAnatomy");
        holdingTicket      = GameObject.Find("HoldingTicket");
        holdingElevatorKey = GameObject.Find("HoldingElevatorKey");

        holdingKey.SetActive(false);
        holdingGun.SetActive(false);
        holdingRock.SetActive(false);
        foreach (GameObject _obj in holdingGloves)
        {
            _obj.SetActive(false);
        }
        holdingAnatomy.SetActive(false);
        holdingPoisonHead.SetActive(false);
        holdingTicket.SetActive(false);
        holdingElevatorKey.SetActive(false);

        unPause = true;

        slotsX      = 6;
        slotsY      = 2;
        lastTapTime = 0;
        tapSpeed    = .25f;

        playerLook       = (MouseLook)GameObject.Find("First Person Controller").GetComponent("MouseLook");
        playerCameraLook = (MouseLook)GameObject.Find("Main Camera").GetComponent("MouseLook");
        database         = GameObject.Find("Item Database").GetComponent <ItemDatabase> ();
        collect          = GetComponent <CollectItem>();
        enemyDamage      = GameObject.Find("HospitalGirl").GetComponent <HospitalGirl> ();
        //AddItem (0);
        //RemoveItem (0);
        //print (InventoryContains(1)); //How many items are in the inventory?
    }
Example #9
0
    public void TestCollect <T> (CollectItem <T> collect, AcceptCollectItem <T> acceptCollect) where T : ItemGroup
    {
        T group = Inventory.Get <T> ();

        group.Clear();
        PerformableTasks.Add(collect);

        // Make sure task doesn't start if the acceptor's inventory is empty
        taskAcceptor.ClearGroup <T> ();
        collect.Start(acceptCollect);
        if (collect.Performing)
        {
            Debug.Log("Collect Item test failed because the task started but acceptor's inventory is empty");
            return;
        }

        taskAcceptor.FillGroup <T> ();
        collect.onComplete += (PerformerTask task) => {
            taskAcceptor.FillGroup <T> ();
            collect.Start(acceptCollect);

            // Make sure the task doesn't start if the performer's inventory is full
            if (collect.Performing)
            {
                Debug.Log("Collect Item test failed because the task started but performer's inventory is full");
            }
            else
            {
                Debug.Log("Collect Item test succeeded :)");
            }
        };

        collect.Start(acceptCollect);
        if (!collect.Performing)
        {
            Debug.Log("Collect Item test failed because the task did not start");
        }
    }
    private void OnTriggerExit2D(Collider2D collision)
    {
        if (Triggers.Contains(collision.gameObject))
        {
            Triggers.Remove(collision.gameObject);
            switch (Type)
            {
            case ButtonType.OneTime:
            case ButtonType.Toggle:
                ActionInput Activator = collision.GetComponent <ActionInput>();
                if (Activator != null)
                {
                    Activator.SetToggleTarget(this);
                    //Activator.SetToggleTarget(this, false);
                }
                break;

            case ButtonType.Weighted:
                UpdateState(false);
                TellManager();
                break;

            case ButtonType.GenericLocked:
                CollectItem Key = collision.GetComponent <CollectItem>();
                if (Key != null)
                {
                    UpdateState(false);
                    TellManager();
                }
                break;

            default:
                break;
            }
        }
    }
Example #11
0
 private void Awake()
 {
     inventoryManager = GameObject.Find("InventoryCanvas").GetComponent <InventoryManager>();
     itemDescription  = GameObject.Find("ItemDescription").GetComponent <Text>();
     collectItem      = GameObject.Find("Player").GetComponent <CollectItem>();
 }
Example #12
0
        public CollectedResult(CollectItem collectItem)
        {
            序号  = collectItem.No;
            A   = collectItem.A;
            B   = collectItem.B;
            M   = collectItem.M;
            电流值 = collectItem.Elec;
            var poles = collectItem.Poles;

            poles.ForEach(pole =>
            {
                switch (pole.Id)
                {
                case 0:
                    电极0 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 1:
                    电极1 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 2:
                    电极2 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 3:
                    电极3 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 4:
                    电极4 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 5:
                    电极5 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 6:
                    电极6 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 7:
                    电极7 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 8:
                    电极8 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 9:
                    电极9 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 10:
                    电极10 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 11:
                    电极11 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 12:
                    电极12 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 13:
                    电极13 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 14:
                    电极14 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 15:
                    电极15 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 16:
                    电极16 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 17:
                    电极17 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 18:
                    电极18 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 19:
                    电极19 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 20:
                    电极20 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 21:
                    电极21 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 22:
                    电极22 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 23:
                    电极23 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 24:
                    电极24 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 25:
                    电极25 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 26:
                    电极26 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 27:
                    电极27 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 28:
                    电极28 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 29:
                    电极29 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 30:
                    电极30 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 31:
                    电极31 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 32:
                    电极32 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 33:
                    电极33 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 34:
                    电极34 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 35:
                    电极35 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 36:
                    电极36 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 37:
                    电极37 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 38:
                    电极38 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 39:
                    电极39 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 40:
                    电极40 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 41:
                    电极41 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 42:
                    电极42 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 43:
                    电极43 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 44:
                    电极44 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 45:
                    电极45 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 46:
                    电极46 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 47:
                    电极47 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 48:
                    电极48 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 49:
                    电极49 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 50:
                    电极50 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 51:
                    电极51 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 52:
                    电极52 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 53:
                    电极53 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 54:
                    电极54 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 55:
                    电极55 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 56:
                    电极56 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 57:
                    电极57 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 58:
                    电极58 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 59:
                    电极59 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 60:
                    电极60 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 61:
                    电极61 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 62:
                    电极62 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;

                case 63:
                    电极63 = Math.Round(pole.Value, PresetInfo.DecimalRound);
                    break;
                }
            });
        }
Example #13
0
 void Start()
 {
     UpdateScore();
     fromCollectItem = gameObject.GetComponent <CollectItem> ();
     fromCollectItem.OnCollectItem += AddScore;         // Listening to the event deom CollectItem
 }
Example #14
0
        public void NetThread()
        {
            SessionIDRequest sessionID = new SessionIDRequest(Storage.Network.UserName, Storage.Network.Password);
            sessionID.SendRequest();

            SharedSecretGenerator sharedSecret = new SharedSecretGenerator(); //random byte[16] gen

            Timer positionUpdater = new Timer(PositionSender, null, Timeout.Infinite, 50); //create position updater

            Socket networkSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            networkSocket.Connect(Storage.Network.Server, Storage.Network.Port);
            _stream = new EnhancedStream(networkSocket);

            Handshake handshake = new Handshake(_stream);
            handshake.Send(Storage.Network.UserName, Storage.Network.Server, Storage.Network.Port); // connect

            Storage.Network.IsConnected = true;

            while (Storage.Network.IsConnected)
            {
                switch (_packetIDbuffer = (byte)_stream.ReadByte())
                {
                    case 0x00:
                        KeepAlive keepAlive = new KeepAlive(_stream);
                        break;
                    case 0x01:
                        LoginRequest loginRequest = new LoginRequest(_stream);
                        //positionUpdater.Change(0, 50);
                        ClientSettings clientSettings = new ClientSettings(_stream);
                        clientSettings.Send();
                        break;
                    case 0x03:
                        ChatMessage chatMessage = new ChatMessage(_stream);
                        break;
                    case 0x04:
                        TimeUpdate timeUpdate = new TimeUpdate(_stream);
                        break;
                    case 0x05:
                        EntityEquipment entityEquipment = new EntityEquipment(_stream);
                        break;
                    case 0x06:
                        SpawnPosition spawnPosition = new SpawnPosition(_stream);
                        break;
                    case 0x08:
                        UpdateHealth updateHealth = new UpdateHealth(_stream);
                        break;
                    case 0x09:
                        RespawnPacket respawnPacket = new RespawnPacket(_stream);
                        break;
                    case 0x0D:
                        _playerPositionLook = new PlayerPositionLook(_stream);
                        break;
                    case 0x10:
                        HeldItemChange heldItemChange = new HeldItemChange(_stream);
                        break;
                    case 0x11:
                        UseBed useBed = new UseBed(_stream);
                        break;
                    case 0x12:
                        Animation animation = new Animation(_stream);
                        break;
                    case 0x14:
                        SpawnNamedEntity spawnNamedEntity = new SpawnNamedEntity(_stream);
                        break;
                    case 0x16:
                        CollectItem collectItem = new CollectItem(_stream);
                        break;
                    case 0x17:
                        SpawnObjectVehicle spawnObjectVehicle = new SpawnObjectVehicle(_stream);
                        break;
                    case 0x18:
                        SpawnMob spawnMob = new SpawnMob(_stream);
                        break;
                    case 0x19:
                        SpawnPainting spawnPainting = new SpawnPainting(_stream);
                        break;
                    case 0x1A:
                        SpawnExperienceOrb spawnExperienceOrb = new SpawnExperienceOrb(_stream);
                        break;
                    case 0x1C:
                        EntityVelocity entityVelocity = new EntityVelocity(_stream);
                        break;
                    case 0x1D:
                        DestroyEntity destroyEntity = new DestroyEntity(_stream);
                        break;
                    case 0x1E:
                        Entity entity = new Entity(_stream);
                        break;
                    case 0x1F:
                        EntityRelativeMove entityRelativeMove = new EntityRelativeMove(_stream);
                        break;
                    case 0x20:
                        EntityLook entityLook = new EntityLook(_stream);
                        break;
                    case 0x21:
                        EntityLookRelativeMove entityLookRelativeMove = new EntityLookRelativeMove(_stream);
                        break;
                    case 0x22:
                        EntityTeleport entityTeleport = new EntityTeleport(_stream);
                        break;
                    case 0x23:
                        EntityHeadLook entityHeadLook = new EntityHeadLook(_stream);
                        break;
                    case 0x26:
                        EntityStatus entityStatus = new EntityStatus(_stream);
                        break;
                    case 0x27:
                        AttachEntity attachEntity = new AttachEntity(_stream);
                        break;
                    case 0x28:
                        EntityMetadata entityMetadata = new EntityMetadata(_stream);
                        break;
                    case 0x29:
                        EntityEffect entityEffect = new EntityEffect(_stream);
                        break;
                    case 0x2A:
                        RemoveEntityEffect removeEntityEffect = new RemoveEntityEffect(_stream);
                        break;
                    case 0x2B:
                        SetExperience setExperience = new SetExperience(_stream);
                        break;
                    case 0x33:
                        ChunkData mapChunk = new ChunkData(_stream);
                        break;
                    case 0x34:
                        MultiBlockChange multiBlockChange = new MultiBlockChange(_stream);
                        break;
                    case 0x35:
                        BlockChange blockChange = new BlockChange(_stream);
                        break;
                    case 0x36:
                        BlockAction blockAction = new BlockAction(_stream);
                        break;
                    case 0x37:
                        BlockBreakAnimation blockBreakAnimation = new BlockBreakAnimation(_stream);
                        break;
                    case 0x38:
                        MapChunkBulk mapChunkBulk = new MapChunkBulk(_stream);
                        break;
                    case 0x3C:
                        Explosion explosion = new Explosion(_stream);
                        break;
                    case 0x3D:
                        SoundParticleEffect soundParticleEffect = new SoundParticleEffect(_stream);
                        break;
                    case 0x3E:
                        NamedSoundEffect namedSoundEffect = new NamedSoundEffect(_stream);
                        break;
                    case 0x46:
                        ChangeGameState changeGameState = new ChangeGameState(_stream);
                        break;
                    case 0x47:
                        Thunderbolt thunderbolt = new Thunderbolt(_stream);
                        break;
                    case 0x64:
                        OpenWindow openWindow = new OpenWindow(_stream);
                        break;
                    case 0x65:
                        CloseWindow closeWindow = new CloseWindow(_stream);
                        break;
                    case 0x67:
                        SetSlot setSlot = new SetSlot(_stream);
                        break;
                    case 0x68:
                        SetWindowItems setWindowItems = new SetWindowItems(_stream);
                        break;
                    case 0x69:
                        UpdateWindowProperty updateWindowProperty = new UpdateWindowProperty(_stream);
                        break;
                    case 0x6A:
                        ConfirmTransaction confirmTransaction = new ConfirmTransaction(_stream);
                        break;
                    case 0x6B:
                        CreativeInventoryAction creativeInventoryAction = new CreativeInventoryAction(_stream);
                        break;
                    case 0x6C:
                        EnchantItem enchantItem = new EnchantItem(_stream);
                        break;
                    case 0x82:
                        UpdateSign updateSign = new UpdateSign(_stream);
                        break;
                    case 0x83:
                        ItemData itemData = new ItemData(_stream);
                        break;
                    case 0x84:
                        UpdateTileEntity updateTileEntity = new UpdateTileEntity(_stream);
                        break;
                    case 0xC8:
                        IncrementStatistic incrementStatistic = new IncrementStatistic(_stream);
                        break;
                    case 0xC9:
                        PlayerListItem playerListItem = new PlayerListItem(_stream);
                        break;
                    case 0xCA:
                        PlayerAbilities playerAbilities = new PlayerAbilities(_stream);
                        break;
                    case 0xCB:
                        TabComplete tabcomplete = new TabComplete(_stream);
                        break;
                    case 0xFA:
                        PluginMessage pluginMessage = new PluginMessage(_stream);
                        break;
                    case 0xFC:
                        EncryptionKeyResponse encryptionKeyResponse = new EncryptionKeyResponse(_stream);
                        encryptionKeyResponse.Get();
                        _stream = new AesStream(networkSocket, _stream, sharedSecret.Get);
                        ClientStatuses clientStatuses = new ClientStatuses(_stream);
                        clientStatuses.Send(0);
                        break;
                    case 0xFD:
                        EncryptionKeyRequest encryptionKeyRequest = new EncryptionKeyRequest(_stream, sharedSecret.Get, sessionID.GetID(), Storage.Network.UserName); //
                        encryptionKeyResponse = new EncryptionKeyResponse(_stream);
                        encryptionKeyResponse.Send(encryptionKeyRequest.GetEncSharedSecret(), encryptionKeyRequest.GetEncToken());
                        break;
                    case 0xFF:
                        positionUpdater = null;
                        DisconnectKick disconnectKick = new DisconnectKick(_stream);
                        networkSocket.Disconnect(false);
                        break;
                    default:
                        throw new Exception("We got a Unknown Packet (" + _packetIDbuffer + ")from the Server. This should not happen: Error in Packet parser");
                }
            }
        }
Example #15
0
        public TestLevel(Texture2D texture, string mapname, Vector2 position)
        {
            this.mapname  = mapname;
            this.position = position;

            switch (mapname)
            {
            case "map":
                map = new int[, ]
                {
                    /*items*/
                    // 1 = blok      // 3 = ladder  // 5 = item // 7 = schuif obj // 9 = falldoor button // 11
                    // 2 = steen     // 4 = button  // 6 = door // 8 = fall door // 10 = pressure plate

                    { 0, 0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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                    { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                };
                break;
            }

            buttons      = new List <Door_button>();
            ladders      = new List <Ladder>();
            stones       = new List <Steen>();
            Tiles        = new List <blok>();
            collectibles = new List <CollectItem>();
            doors        = new List <Door>();
            moveObjects  = new List <MoveObject>();
            Mdoors       = new List <MoveDoor>();
            Mbuttons     = new List <MoveDoorButton>();
            plates       = new List <PressurePlate>();

            CheckRtiles = new List <blok>();
            CheckLtiles = new List <blok>();
            CheckBtiles = new List <blok>();


            this.tiletexture = texture;

            buttonIndex = 0;
            ladderIndex = 0;
            doorIndex   = 0;


            center       = new Vector2(this.Width / 2 * 44, this.Heigth / 2 * 44);
            SpawnNextlvl = false;


            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Heigth; y++)
                {
                    //Assets in het Grid genereren
                    int textureIndex = map[y, x];
                    if (textureIndex == 0)
                    {
                        continue;
                    }
                    switch (textureIndex)
                    {
                    case 1:
                        blok tile = new blok(tiletexture, new Vector2(position.X + x * 44, position.Y + y * 44));
                        Tiles.Add(tile);
                        break;

                    case 2:
                        Steen          steen   = new Steen(Game1.crushstone, 13, 1);
                        AnimationClass animate = new AnimationClass();
                        steen.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        steen.addAnimation(Game1.crushstone, "idle", 1, 13, animate.Copy());
                        steen.Animation = "idle";

                        stones.Add(steen);
                        break;

                    case 3:
                        Ladder ladder = new Ladder(Game1.laddertextures[ladderIndex], new Vector2(position.X + x * 44, position.Y + y * 44));
                        ladderIndex++;
                        ladders.Add(ladder);
                        break;

                    case 4:
                        Door_button    button   = new Door_button(Game1.button_tex, 12, 1, buttonIndex);
                        AnimationClass animate2 = new AnimationClass();
                        button.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        button.addAnimation(Game1.button_tex, "idle", 1, 12, animate2.Copy());
                        button.Animation = "idle";
                        buttonIndex++;
                        buttons.Add(button);
                        break;

                    case 5:
                        CollectItem    item     = new CollectItem(Game1.slaktex, 50, 1);
                        AnimationClass animate3 = new AnimationClass();
                        item.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        item.addAnimation(Game1.slaktex, "idle", 1, 50, animate3.Copy());
                        item.Animation = "idle";
                        collectibles.Add(item);
                        break;

                    case 6:
                        Door door = new Door(Game1.door_tex, new Vector2(position.X + x * 44, position.Y + y * 44), doorIndex);
                        doorIndex++;
                        doors.Add(door);
                        break;

                    case 7:
                        MoveObject     obj      = new MoveObject(Game1.stonetex, 15, 1);
                        AnimationClass animate5 = new AnimationClass();
                        obj.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        obj.addAnimation(Game1.stonetex, "idle2", 1, 15, animate5.Copy());
                        obj.Animation = "idle2";
                        moveObjects.Add(obj);
                        break;

                    case 8:
                        MoveDoor objdoor = new MoveDoor(Game1.fallStone, new Vector2(position.X + x * 44, position.Y + y * 44), moveDoorIndex);
                        moveDoorIndex++;
                        Mdoors.Add(objdoor);
                        break;

                    case 9:
                        MoveDoorButton button2  = new MoveDoorButton(Game1.button_tex, 12, 1, moveButtonIndex);
                        AnimationClass animate6 = new AnimationClass();
                        button2.position = new Vector2(position.X + x * 44, position.Y + y * 44);
                        button2.addAnimation(Game1.button_tex, "idle", 1, 12, animate6.Copy());
                        button2.Animation = "idle";
                        moveButtonIndex++;
                        Mbuttons.Add(button2);
                        break;

                    case 10:
                        PressurePlate plate = new PressurePlate(Game1.pressureplate, new Vector2(position.X + x * 44, position.Y + y * 55));
                        plates.Add(plate);
                        break;

                    case 11:
                        liftobject = new LiftObject(Game1.liftobj, new Vector2(position.X + x * 44, position.Y + y * 44));
                        break;
                    }
                }
            }
        }
    //[SerializeField]
    //CollectItem Item;
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        ShowBaseElements = EditorGUILayout.Toggle(new GUIContent("Show Raw Elements", "Shows ALL the variables mostly a debug check"), ShowBaseElements);
        if (ShowBaseElements)
        {
            base.OnInspectorGUI();
        }



        GUILayout.Label("----CUSTOM EDITOR----", EditorStyles.boldLabel);
        //serializedObject.FindProperty("MyType").enumValueIndex = EditorGUILayout.EnumPopup("Item Type",);

        //EditorGUILayout.PropertyField(serializedObject.FindProperty("MyType"));
        CollectItem Item = (CollectItem)target;

        /*
         * var offsetProperty = serializedObject.FindProperty("Offset");
         * EditorGUILayout.PropertyField(offsetProperty);
         * serializedObject.ApplyModifiedProperties();
         */

        var ObjectField = serializedObject.FindProperty("MyType");

        EditorGUILayout.PropertyField(ObjectField);


        switch (Item.MyType)
        {
        case CollectibleType.GENERICKEY:
        case CollectibleType.SPECIALKEY:
            #region
            GUILayout.Label("----KEYS EDITOR----", EditorStyles.boldLabel);
            ObjectField = serializedObject.FindProperty("TargetToToggle");
            EditorGUILayout.PropertyField(ObjectField);
            #endregion
            break;

        case CollectibleType.COLLECTIBLE:
            #region
            GUILayout.Label("----COLLECTABLE EDITOR----", EditorStyles.boldLabel);
            ObjectField = serializedObject.FindProperty("AuxNumber");
            EditorGUILayout.PropertyField(ObjectField, new GUIContent("Stage Collectible", "Which collectible Index it should target"));
            #endregion
            break;

        case CollectibleType.POWERUP:
            #region
            GUILayout.Label("----POWERUPS EDITOR----", EditorStyles.boldLabel);
            GUILayout.Label("This is uhhh... Being worked on", EditorStyles.label);
            #endregion
            break;

        case CollectibleType.SHOTOVERRIDE:
        case CollectibleType.TEMPSHOT:
            GUILayout.Label("----SHOT OVERRIDE EDITOR----", EditorStyles.boldLabel);
            ObjectField = serializedObject.FindProperty("AbilitySlot");
            EditorGUILayout.PropertyField(ObjectField);
            ObjectField = serializedObject.FindProperty("MyAbility");
            EditorGUILayout.PropertyField(ObjectField);
            ObjectField = serializedObject.FindProperty("AuxNumber");
            EditorGUILayout.PropertyField(ObjectField, new GUIContent("ShotCount", "How many shots till you revert"));
//EditorGUILayout.PropertyField(ObjectField, new GUIContent("Delay", "How fast between Updates the collider/sprite"));
            break;

        default:
            break;
        }



        serializedObject.ApplyModifiedProperties();
    }
 public void OnCollectItem(CollectItem packet)
 {
 }
 private void InvokeCollectItem(CollectItem packet)
 {
     packetListener.OnCollectItem(packet);
 }
Example #19
0
        public void NetThread()
        {
            SessionIDRequest sessionID = new SessionIDRequest(Storage.Network.UserName, Storage.Network.Password);

            sessionID.SendRequest();

            SharedSecretGenerator sharedSecret = new SharedSecretGenerator();              //random byte[16] gen

            Timer positionUpdater = new Timer(PositionSender, null, Timeout.Infinite, 50); //create position updater

            Socket networkSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            networkSocket.Connect(Storage.Network.Server, Storage.Network.Port);
            _stream = new EnhancedStream(networkSocket);

            Handshake handshake = new Handshake(_stream);

            handshake.Send(Storage.Network.UserName, Storage.Network.Server, Storage.Network.Port); // connect

            Storage.Network.IsConnected = true;

            while (Storage.Network.IsConnected)
            {
                switch (_packetIDbuffer = (byte)_stream.ReadByte())
                {
                case 0x00:
                    KeepAlive keepAlive = new KeepAlive(_stream);
                    break;

                case 0x01:
                    LoginRequest loginRequest = new LoginRequest(_stream);
                    //positionUpdater.Change(0, 50);
                    ClientSettings clientSettings = new ClientSettings(_stream);
                    clientSettings.Send();
                    break;

                case 0x03:
                    ChatMessage chatMessage = new ChatMessage(_stream);
                    break;

                case 0x04:
                    TimeUpdate timeUpdate = new TimeUpdate(_stream);
                    break;

                case 0x05:
                    EntityEquipment entityEquipment = new EntityEquipment(_stream);
                    break;

                case 0x06:
                    SpawnPosition spawnPosition = new SpawnPosition(_stream);
                    break;

                case 0x08:
                    UpdateHealth updateHealth = new UpdateHealth(_stream);
                    break;

                case 0x09:
                    RespawnPacket respawnPacket = new RespawnPacket(_stream);
                    break;

                case 0x0D:
                    _playerPositionLook = new PlayerPositionLook(_stream);
                    break;

                case 0x10:
                    HeldItemChange heldItemChange = new HeldItemChange(_stream);
                    break;

                case 0x11:
                    UseBed useBed = new UseBed(_stream);
                    break;

                case 0x12:
                    Animation animation = new Animation(_stream);
                    break;

                case 0x14:
                    SpawnNamedEntity spawnNamedEntity = new SpawnNamedEntity(_stream);
                    break;

                case 0x16:
                    CollectItem collectItem = new CollectItem(_stream);
                    break;

                case 0x17:
                    SpawnObjectVehicle spawnObjectVehicle = new SpawnObjectVehicle(_stream);
                    break;

                case 0x18:
                    SpawnMob spawnMob = new SpawnMob(_stream);
                    break;

                case 0x19:
                    SpawnPainting spawnPainting = new SpawnPainting(_stream);
                    break;

                case 0x1A:
                    SpawnExperienceOrb spawnExperienceOrb = new SpawnExperienceOrb(_stream);
                    break;

                case 0x1C:
                    EntityVelocity entityVelocity = new EntityVelocity(_stream);
                    break;

                case 0x1D:
                    DestroyEntity destroyEntity = new DestroyEntity(_stream);
                    break;

                case 0x1E:
                    Entity entity = new Entity(_stream);
                    break;

                case 0x1F:
                    EntityRelativeMove entityRelativeMove = new EntityRelativeMove(_stream);
                    break;

                case 0x20:
                    EntityLook entityLook = new EntityLook(_stream);
                    break;

                case 0x21:
                    EntityLookRelativeMove entityLookRelativeMove = new EntityLookRelativeMove(_stream);
                    break;

                case 0x22:
                    EntityTeleport entityTeleport = new EntityTeleport(_stream);
                    break;

                case 0x23:
                    EntityHeadLook entityHeadLook = new EntityHeadLook(_stream);
                    break;

                case 0x26:
                    EntityStatus entityStatus = new EntityStatus(_stream);
                    break;

                case 0x27:
                    AttachEntity attachEntity = new AttachEntity(_stream);
                    break;

                case 0x28:
                    EntityMetadata entityMetadata = new EntityMetadata(_stream);
                    break;

                case 0x29:
                    EntityEffect entityEffect = new EntityEffect(_stream);
                    break;

                case 0x2A:
                    RemoveEntityEffect removeEntityEffect = new RemoveEntityEffect(_stream);
                    break;

                case 0x2B:
                    SetExperience setExperience = new SetExperience(_stream);
                    break;

                case 0x33:
                    ChunkData mapChunk = new ChunkData(_stream);
                    break;

                case 0x34:
                    MultiBlockChange multiBlockChange = new MultiBlockChange(_stream);
                    break;

                case 0x35:
                    BlockChange blockChange = new BlockChange(_stream);
                    break;

                case 0x36:
                    BlockAction blockAction = new BlockAction(_stream);
                    break;

                case 0x37:
                    BlockBreakAnimation blockBreakAnimation = new BlockBreakAnimation(_stream);
                    break;

                case 0x38:
                    MapChunkBulk mapChunkBulk = new MapChunkBulk(_stream);
                    break;

                case 0x3C:
                    Explosion explosion = new Explosion(_stream);
                    break;

                case 0x3D:
                    SoundParticleEffect soundParticleEffect = new SoundParticleEffect(_stream);
                    break;

                case 0x3E:
                    NamedSoundEffect namedSoundEffect = new NamedSoundEffect(_stream);
                    break;

                case 0x46:
                    ChangeGameState changeGameState = new ChangeGameState(_stream);
                    break;

                case 0x47:
                    Thunderbolt thunderbolt = new Thunderbolt(_stream);
                    break;

                case 0x64:
                    OpenWindow openWindow = new OpenWindow(_stream);
                    break;

                case 0x65:
                    CloseWindow closeWindow = new CloseWindow(_stream);
                    break;

                case 0x67:
                    SetSlot setSlot = new SetSlot(_stream);
                    break;

                case 0x68:
                    SetWindowItems setWindowItems = new SetWindowItems(_stream);
                    break;

                case 0x69:
                    UpdateWindowProperty updateWindowProperty = new UpdateWindowProperty(_stream);
                    break;

                case 0x6A:
                    ConfirmTransaction confirmTransaction = new ConfirmTransaction(_stream);
                    break;

                case 0x6B:
                    CreativeInventoryAction creativeInventoryAction = new CreativeInventoryAction(_stream);
                    break;

                case 0x6C:
                    EnchantItem enchantItem = new EnchantItem(_stream);
                    break;

                case 0x82:
                    UpdateSign updateSign = new UpdateSign(_stream);
                    break;

                case 0x83:
                    ItemData itemData = new ItemData(_stream);
                    break;

                case 0x84:
                    UpdateTileEntity updateTileEntity = new UpdateTileEntity(_stream);
                    break;

                case 0xC8:
                    IncrementStatistic incrementStatistic = new IncrementStatistic(_stream);
                    break;

                case 0xC9:
                    PlayerListItem playerListItem = new PlayerListItem(_stream);
                    break;

                case 0xCA:
                    PlayerAbilities playerAbilities = new PlayerAbilities(_stream);
                    break;

                case 0xCB:
                    TabComplete tabcomplete = new TabComplete(_stream);
                    break;

                case 0xFA:
                    PluginMessage pluginMessage = new PluginMessage(_stream);
                    break;

                case 0xFC:
                    EncryptionKeyResponse encryptionKeyResponse = new EncryptionKeyResponse(_stream);
                    encryptionKeyResponse.Get();
                    _stream = new AesStream(networkSocket, _stream, sharedSecret.Get);
                    ClientStatuses clientStatuses = new ClientStatuses(_stream);
                    clientStatuses.Send(0);
                    break;

                case 0xFD:
                    EncryptionKeyRequest encryptionKeyRequest = new EncryptionKeyRequest(_stream, sharedSecret.Get, sessionID.GetID(), Storage.Network.UserName);     //
                    encryptionKeyResponse = new EncryptionKeyResponse(_stream);
                    encryptionKeyResponse.Send(encryptionKeyRequest.GetEncSharedSecret(), encryptionKeyRequest.GetEncToken());
                    break;

                case 0xFF:
                    positionUpdater = null;
                    DisconnectKick disconnectKick = new DisconnectKick(_stream);
                    networkSocket.Disconnect(false);
                    break;

                default:
                    throw new Exception("We got a Unknown Packet (" + _packetIDbuffer + ")from the Server. This should not happen: Error in Packet parser");
                }
            }
        }
Example #20
0
 void Start()
 {
     UpdateScore ();
     fromCollectItem = gameObject.GetComponent<CollectItem> ();
     fromCollectItem.OnCollectItem += AddScore; // Listening to the event deom CollectItem
 }