コード例 #1
0
    private void OnTouchDown(int fingerIndex, Vector2 fingerPos)
    {
        if (!gameObject.activeInHierarchy || (ignoreOnPopUp && RatingAgent.GetPopUpEnabled()))
        {
            return;
        }

        if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, fingerPos, null) && !GameAgent.GetWasHolding())
        {
            colorController.SetColor(ColorAgent.GetCurrentColorPack().midColor);
        }
    }
コード例 #2
0
    public void Rewind()
    {
        if (moveHistory.Count > 0)
        {
            if (teleportHistory.ContainsKey(moveCount))
            {
                //special
                transform.position = teleportHistory[moveCount];
                teleportHistory.Remove(moveCount);
            }
            playerColorCon.SetColor(moveHistory[0].colorIndex);
            int inversedDirectionValue = (int)moveHistory[0].direction * -1;
            StartCoroutine(MoveInDirection((Direction)inversedDirectionValue, moveHistory[0].yPos, true));
            if (moveHistory[0].yPos > transform.position.y)
            {
                PlayerScript.allowForward = PlayerScript.allowBack = PlayerScript.allowLeft = PlayerScript.allowRight = true;
            }

            moveHistory.RemoveAt(0);
            justRewinded = true;
        }
    }
コード例 #3
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Bullet")
        {
            Vector3 directionToGo = Vector3.Reflect(other.transform.forward, transform.up + transform.forward);
            other.transform.forward     = new Vector3(directionToGo.x, 0, directionToGo.z);
            other.transform.eulerAngles = new Vector3(other.transform.eulerAngles.x, Mathf.Round(other.transform.eulerAngles.y / 90) * 90, other.transform.eulerAngles.z);
            other.transform.position    = new Vector3(Mathf.Round(transform.parent.position.x), other.transform.position.y, Mathf.Round(transform.parent.position.z));

            //dont change bullet's color if the reflector is default color
            ColorController otherColorCon = other.GetComponent <ColorController>();
            if (colorIndexThatDoesNotChangeBulletColor != thisColorCon.thisColorIndex)
            {
                otherColorCon.SetColor(thisColorCon.thisColorIndex);
            }
        }
    }
コード例 #4
0
ファイル: MoveableScript.cs プロジェクト: troygamedev/cubeinc
    public void Rewind(bool playerFell)
    {
        if (moveCountAtSpawnTime == PlayerScript.moveCount)
        {
            isFall            = true;
            rbody.isKinematic = false;
            disintegration.StartCoroutine("Disintegrate");
        }
        else
        {
            if (moveHistory.Count > 0)
            {
                if (playerFell)
                {
                    if (moveHistory.ContainsKey(PlayerScript.moveCount))
                    {
                        MoveHistoryItem move;
                        moveHistory.TryGetValue(PlayerScript.moveCount, out move);

                        moveHistory.Remove(PlayerScript.moveCount);
                        int inversedDirectionValue = (int)move.direction * -1;


                        if (isFall)
                        {
                            //transform.root.gameObject.SetActive(true);
                            StartCoroutine(RecoverFromFall());
                        }
                        else
                        {
                            transform.eulerAngles = new Vector3(0, move.yRotation, 90);
                            StartCoroutine(MoveToDirection((Direction)inversedDirectionValue, move.height, true));
                            colorCon.SetColor(move.colorIndex);
                        }
                    }
                }
                else
                {
                    if (moveHistory.ContainsKey(PlayerScript.moveCount - 1))
                    {
                        MoveHistoryItem move;
                        moveHistory.TryGetValue(PlayerScript.moveCount - 1, out move);

                        moveHistory.Remove(PlayerScript.moveCount - 1);
                        int inversedDirectionValue = (int)move.direction * -1;


                        if (isFall)
                        {
                            //transform.root.gameObject.SetActive(true);
                            StartCoroutine(RecoverFromFall());
                        }
                        else
                        {
                            transform.eulerAngles = new Vector3(0, move.yRotation, 90);
                            StartCoroutine(MoveToDirection((Direction)inversedDirectionValue, move.height, true));
                            colorCon.SetColor(move.colorIndex);
                        }
                    }
                }
            }
        }
    }