Esempio n. 1
0
    public void SwitchingGems()
    {
        //print("++ Board_C.SwitchingGems main_gem_selected_x = " + main_gem_selected_x + " main_gem_selected_y = " + main_gem_selected_y);
        //print("++ Board_C.SwitchingGems minor_gem_destination_to_x = " + minor_gem_destination_to_x + " minor_gem_destination_to_y = " + minor_gem_destination_to_y);
        current_moveStatus = moveStatus.switchingGemsAnimationOngoing;

        //Switching gems ongoing
        board_array_master[main_gem_selected_x, main_gem_selected_y, 11] = 6;
        board_array_master[minor_gem_destination_to_x, minor_gem_destination_to_y, 11] = 6;


        //reset variables
        number_of_elements_to_damage_with_SwitchingGems = 0;
        explode_same_color_again_with  = 0;//0 = false; 1 = with main gem; 2 =with minor gem
        score_of_this_turn_move        = 0;
        n_gems_exploded_with_main_gem  = 0;
        n_gems_exploded_with_minor_gem = 0;


        //if (!player_can_move_when_gem_falling)
        {
            cursor.gameObject.SetActive(false);
            Cancell_hint();
            player_can_move = false;
        }

        Move_gems_to_target_positions();
        Center_camera_to_move();
        //print("-- Board_C.SwitchingGems");
    }
Esempio n. 2
0
    public void Update_turn_order_after_a_bad_move()
    {
        //print("++ Board_C.Update_turn_order_after_a_bad_move main_gem_selected_x = " + main_gem_selected_x + " main_gem_selected_y = " + main_gem_selected_y);
        //print("++ Board_C.Update_turn_order_after_a_bad_move minor_gem_destination_to_x = " + minor_gem_destination_to_x + " minor_gem_destination_to_y = " + minor_gem_destination_to_y);

        //print("Update_turn_order_after_a_bad_move()");

        current_player_chain_lenght = 0;
        player_can_move             = true;

        current_moveStatus = moveStatus.waitingNewMove;
    }
Esempio n. 3
0
    private void Start()
    {
        m_moveStatus = moveStatus.Normal;
        Instance     = this;
        health       = enemySettings.startHealth;
        speed        = enemySettings.moveSpeed;
        Vector2Int nextWaypoint = GameManager.Instance.enemyPath[currentWaypoint];
        GameObject targetTile   = GameManager.Instance.grid[nextWaypoint.y, nextWaypoint.x];

        transform.position = targetTile.transform.position;
        GameManager.Instance.RegisterEnemy(this);
    }
Esempio n. 4
0
    void Empty_main_and_minor_gem_selections()
    {
        //Debug.LogWarning("Empty_main_and_minor_gem_selections() " + call_from + " ... " + minor_gem_destination_to_x);
        //NEW CODE TO TEST:

        /*
         * if (main_gem_selected_x != -10)
         * {
         *  tiles_array[minor_gem_destination_to_x, minor_gem_destination_to_y].GetComponent<tile_C>().use_fx_big_explosion_here = 0;
         *      tiles_array[main_gem_selected_x, main_gem_selected_y].GetComponent<tile_C>().use_fx_big_explosion_here = 0;
         * }*/

        if (board_array_master[main_gem_selected_x, main_gem_selected_y, 11] == 6)//if not exploded
        {
            board_array_master[main_gem_selected_x, main_gem_selected_y, 11]      = 0;
            tiles_array[main_gem_selected_x, main_gem_selected_y].my_gem_renderer = tiles_array[main_gem_selected_x, main_gem_selected_y].my_gem.GetComponent <SpriteRenderer>();
        }

        if (board_array_master[minor_gem_destination_to_x, minor_gem_destination_to_y, 11] == 6)//if not exploded
        {
            board_array_master[minor_gem_destination_to_x, minor_gem_destination_to_y, 11]      = 0;
            tiles_array[minor_gem_destination_to_x, minor_gem_destination_to_y].my_gem_renderer = tiles_array[main_gem_selected_x, main_gem_selected_y].my_gem.GetComponent <SpriteRenderer>();
        }

        //Debug.LogWarning("Empty_main_and_minor_gem_selections() " + call_from);// + player_can_move);
        main_gem_selected_x        = -10;
        main_gem_selected_y        = -10;
        avatar_main_gem            = null;
        main_gem_color             = -10;
        minor_gem_destination_to_x = -10;
        minor_gem_destination_to_y = -10;
        avatar_minor_gem           = null;
        minor_gem_color            = -10;

        current_moveStatus = moveStatus.waitingNewMove;
    }
Esempio n. 5
0
    private void MovementBehavior()
    {
        if (m_moveStatus == moveStatus.Normal)
        {
            speed = enemySettings.moveSpeed;
        }

        if (m_moveStatus == moveStatus.Slow)
        {
            speed = 0.25f;

            if (startTimer <= endTimer)
            {
                //Debug.Log("test");
                m_moveStatus = moveStatus.Normal;
                slowedDown   = false;
                startTimer   = 10;
            }
            else
            {
                startTimer -= Time.deltaTime;
            }
        }
    }
Esempio n. 6
0
        /// <summary>
        /// Method for performing the MOVE instruction
        /// </summary>
        public static bool Move(ModuleBase module, MixInstruction.Instance instance)
        {
            mMoveStatuses.TryGetValue(module.ModuleName, out moveStatus status);

            // if we have a move status, check if it applies to this instruction
            if (status != null && status.ProgramCounter != module.ProgramCounter)
            {
                status = null;
                mMoveStatuses.Remove(module.ModuleName);
            }

            if (status == null)
            {
                var fromAddress = InstructionHelpers.GetValidIndexedAddress(module, instance.AddressValue, instance.Index);
                if (fromAddress == int.MinValue)
                {
                    return(false);
                }

                var toAddress = InstructionHelpers.GetValidIndexedAddress(module, 0, 1);
                if (toAddress == int.MinValue)
                {
                    return(false);
                }

                status = new moveStatus(module.ProgramCounter, fromAddress, toAddress, instance.FieldSpec.MixByteValue.ByteValue);
                mMoveStatuses[module.ModuleName] = status;

                return(false);
            }

            // the MOVE instruction takes two ticks per moved word...
            switch (status.CurrentWordState)
            {
            // ... during one of those, the actual move is performed...
            case moveStatus.WordStates.BeforeMove:
            case moveStatus.WordStates.RegisterIncreased:
                IMemory memory             = module.Memory;
                int     currentFromAddress = status.FromAddress + status.CurrentWord;
                int     currentToAddress   = status.ToAddress + status.CurrentWord;

                if (currentFromAddress > memory.MaxWordIndex || currentToAddress > memory.MaxWordIndex)
                {
                    module.ReportRuntimeError("Source or target address overflow");
                    status = null;
                    mMoveStatuses.Remove(module.ModuleName);

                    return(false);
                }

                memory[currentToAddress] = memory[currentFromAddress];
                status.CurrentWordState  = moveStatus.WordStates.Moved;

                break;

            // ... during the other, the value of rI1 is increased
            case moveStatus.WordStates.Moved:
                Register rI1 = module.Registers.RI1;
                rI1.LongValue++;
                status.NextWord();

                if (status.CurrentWord >= status.WordCount)
                {
                    status = null;
                    mMoveStatuses.Remove(module.ModuleName);
                    return(true);
                }

                status.CurrentWordState = moveStatus.WordStates.RegisterIncreased;

                break;
            }

            // return false to prevent the PC from increasing
            return(false);
        }