示例#1
0
    /// <summary>
    /// Excute the mouse raycast system;
    /// Whether we should put this to update or fixed-update, or adjust the MouseRayCast class,
    /// is a debatable question, both of them have pros and cons;
    /// </summary>
    private void receiv_mouse_cast()
    {
        RaycastHit hit_info        = MouseRayCast.IS.Get_hitinfo();
        ChestGroup hit_chest_group = null;

        if (MouseRayCast.IS.hit_flag && hit_info.transform.CompareTag(SD.ChestGroupTriggerTag) &&
            hit_info.transform.GetComponent <GeneralTrigger>() != null)
        {
            hit_chest_group = hit_info.transform.GetComponent <GeneralTrigger>().
                              Get_root_TRANS().GetComponent <ChestGroup>();
            if (hit_chest_group.Cid != hovering_id)
            {
                if (hovering_id != Invalid_chest_id)
                {
                    IGRC.IS.ChestGroup_TRANS_dict[hovering_id].GetComponent <ChestGroup>().MouseUnHover();
                }
                hit_chest_group.MouseHover();
            }
            hovering_id = hit_chest_group.Cid;
        }
        else
        {
            if (hovering_id != Invalid_chest_id)
            {
                IGRC.IS.ChestGroup_TRANS_dict[hovering_id].GetComponent <ChestGroup>().MouseUnHover();
            }
            hovering_id = Invalid_chest_id;
        }
    }
示例#2
0
    /// <summary>
    /// Open chest action;
    /// </summary>
    private void open_chest()
    {
        ChestGroup temp = null;

        if (curr_GMstate == GameModeState.ChooseChest)
        {
            if (hovering_id == Invalid_chest_id || curr_chest_reward_index >= chest_reward_arr.Length)
            {
                return;
            }
            float reward = chest_reward_arr[curr_chest_reward_index];
            temp = IGRC.IS.ChestGroup_TRANS_dict[hovering_id].GetComponent <ChestGroup>();
            if (temp == null || !temp.OpenChest(reward, reward == Pooper_reward_amount,
                                                text_animation: GSD.IS.Use_chest_text_ani, ani_tier: chest_ani_tier_arr))
            {
                return;
            }
            curr_win += Mathf.Max(reward, 0.0f);
            ++curr_chest_reward_index;
            if (reward == Pooper_reward_amount)
            {
                finish_choose_chest();
            }
        }
    }
示例#3
0
 /// <summary>
 /// Set the lock state of a single chest group;
 /// </summary>
 /// <param name="lockstate"></param>
 private void toggle_lock_singleCGroup(ChestGroup chest_group, bool lockstate)
 {
     if (lockstate)
     {
         chest_group.Lock_Cgroup();
     }
     else
     {
         chest_group.Unlock_Cgroup();
     }
 }
示例#4
0
    /// <summary>
    /// Spawn a single chest group;
    /// </summary>
    /// <param name="pos"></param>
    /// <param name="id"></param>
    private void spawn_single_CG(Vector3 pos, int id)
    {
        Transform temp_TRANS = Instantiate(IGRC.IS.ChestGroup_PRE, pos, Quaternion.identity).transform;

        temp_TRANS.parent      = IGRC.IS.ChestGroup_parent;
        temp_TRANS.localScale *= chestg_scale;
        IGRC.IS.ChestGroup_TRANS_dict.Add(id, temp_TRANS);
        ChestGroup chest_group = temp_TRANS.GetComponent <ChestGroup>();

        chest_group.Init_CG(id);
    }