示例#1
0
    void Update()
    {
        while (AllCells.Remove(null))
        {
        }

        if (AllCells.Count < 1)
        {
            FadeCameraController.Lose();
            Destroy(this);
            return;
        }

        var mousePos = getMouseWorldPos();

        if (Input.GetMouseButtonDown(0))
        {
            cachedSelection.Clear();
            if (Input.GetKey(KeyCode.LeftShift))
            {
                cachedSelection.AddRange(selectedCells);
            }

            selectoid    = (Instantiate(selectoidPrefab, null) as GameObject).GetComponent <SelectoidController>();
            selectionPtA = mousePos;
        }

        if (Input.GetMouseButton(0))
        {
            selectionPtB = mousePos;
            selectoid.transform.position = (selectionPtA + selectionPtB) / 2f;
            selectoid.SetSize((selectionPtB - selectionPtA).Abs());

            updateSelection();
        }

        if (Input.GetMouseButtonUp(0))
        {
            Destroy(selectoid.gameObject);
            selectoid = null;
        }

        if (shouldUpdateSelectedCells || Input.GetMouseButtonDown(1))
        {
            shouldUpdateSelectedCells = false;
            updateAttractionListInAllCells();
        }

        if (Input.GetMouseButton(1))
        {
            updateSeekPointInSelectedCells(mousePos);
        }

        if (Input.GetKey(KeyCode.Space))
        {
            ApoptosisSelection();
        }

        updateCameraPosition();
    }
示例#2
0
    void ApoptosisSelection()
    {
        foreach (CellController apoptosisCell in selectedCells)
        {
            foreach (CellController otherCell in AllCells)
            {
                otherCell.attraction.Remove(apoptosisCell);
            }
            apoptosisCell.Apoptosis();
            AllCells.Remove(apoptosisCell);
        }
        cachedSelection.Clear();
        selectedCells.Clear();
        unselectedCells.Clear();

        Audio.Play("squishSmall");
    }