コード例 #1
0
    /// <summary>
    /// Called when collision area touched.
    /// 충돌영역 어딘가에 터치 이벤트가 발생 했을 때.
    /// </summary>
    /// <param name="target"></param>
    void on_touch_collision_area(GameObject target)
    {
        // When touched a character.
        // 캐릭터를 터치했을 때.
        CVirus virus = target.GetComponent <CVirus>();

        if (virus != null)
        {
            this.selected_character_position = virus.cell;

            this.room.get_current_player().GetComponent <CPlayerRenderer>().stop();
            virus.on_touch();

            show_movable_area(virus.cell);
            return;
        }

        // When touched an empty cell.
        // 빈 셀을 터치했을 때.
        CButtonAction cell = target.GetComponent <CButtonAction>();

        if (cell != null)
        {
            on_cell_touch((short)cell.index);
            return;
        }
    }
コード例 #2
0
    public void remove(short position)
    {
        CVirus virus = this.viruses.Find(v => v.is_same(position));

        if (virus == null)
        {
            // null이면 안되는데??
            Debug.LogErrorFormat("Cannot find a virus of the position. position : {0}", position);
            return;
        }

        this.viruses.Remove(virus);
        virus.destroy();
        GameObject.Destroy(virus.gameObject, 1.0f);
    }
コード例 #3
0
    public void add(short position)
    {
        // Create an instance.
        // 바이러스 인스턴스 생성.
        GameObject clone = CGameWorld.Instance.instantiate(this.prefab_character);

        clone.transform.parent = transform;

        // Set position.
        // 좌표 설정.
        Vector2 map_position = CHelper.convert_to_position(position);

        clone.transform.localPosition = CHelper.map_to_world(map_position);

        // Set default state.
        // 상태 설정.
        CVirus virus = clone.GetComponent <CVirus>();

        virus.update_position(position);
        virus.idle();

        this.viruses.Add(virus);
    }