Exemple #1
0
    // caution: this method could be run twice, not necessarily just once, right after the piece is instantiated
    void Start()
    {
        // initialize instance variables
        isNew = true;
        currPlacementCorrection = PlacementCorrectionType.None;
        collidersInContact      = new List <Collider>();
        canMoveDown             = true;
        canMoveTowardsNegX      = true;
        canMoveTowardsPosX      = true;
        canMoveTowardsNegZ      = true;
        canMoveTowardsPosZ      = true;
        mainCamera       = Camera.main;
        raycastingScript = GameObject.Find("Main Script Object").GetComponent <RaycastingBehaviour>();
        GameObject floor = GameObject.Find("Floor");

        floorY             = floor.transform.position.y;
        pieces             = raycastingScript.pieces;
        pieceControlsLabel = raycastingScript.pieceControlsLabel;
        pieceControlsPanel = raycastingScript.pieceControlsPanel;
        pieceSpecificSetup();
        halo            = getHalo();
        savedTransforms = new Dictionary <GameObject, SavedTransformInfo>();
        savedVelocities = new Dictionary <GameObject, SavedVelocityInfo>();

        // move piece to position of touch (keeping it the same depth/distance from the camera as it was upon instantiation)
        // as seen in the fact that this is in Start, it should only happen upon instantiation. Position changes thereafter depend on how much the finger moves
        Vector3 currScreenPosition = mainCamera.WorldToScreenPoint(transform.position);
        Touch   touch = Input.GetTouch(0);

        transform.position = mainCamera.ScreenToWorldPoint(new Vector3(touch.position.x, touch.position.y, currScreenPosition.z));

        // leave the following line as the last line of the method
        setupComplete = true;
    }
Exemple #2
0
 // Start is called before the first frame update
 void Start()
 {
     raycastingScript       = mainScriptObject.GetComponent <RaycastingBehaviour>();
     camLeftButtonScript    = camLeftButton.GetComponent <CameraRotateLeftButtonBehaviour>();
     camRightButtonScript   = camRightButton.GetComponent <CameraRotateRightButtonBehaviour>();
     pieceLeftButtonScript  = pieceLeftButton.GetComponent <PieceRotateLeftButtonBehaviour>();
     pieceRightButtonScript = pieceRightButton.GetComponent <PieceRotateRightButtonBehaviour>();
 }
 // Start is called before the first frame update
 void Start()
 {
     raycastingScript = mainScriptObject.GetComponent <RaycastingBehaviour>();
 }
 // Start is called before the first frame update
 void Start()
 {
     raycastingScript = mainScriptObject.GetComponent <RaycastingBehaviour>();
     physicsOn        = false;
 }
 // Start is called before the first frame update
 void Start()
 {
     raycastingScript  = mainScriptObject.GetComponent <RaycastingBehaviour>();
     resetButtonScript = resetButtonObject.GetComponent <ResetButtonBehaviour>();
 }
    public GameObject camRotationCenter; // connected in editor

    // Start is called before the first frame update
    void Start()
    {
        camRotationDirection = 0;
        raycastingScript     = mainScriptObject.GetComponent <RaycastingBehaviour>();
    }
 // Start is called before the first frame update
 void Start()
 {
     resettable            = false;
     raycastingScript      = mainScriptObject.GetComponent <RaycastingBehaviour>();
     startStopButtonScript = startStopObject.GetComponent <StartStopButtonBehaviour>();
 }
 // Start is called before the first frame update
 void Start()
 {
     raycastingScript = GameObject.Find("Main Script Object").GetComponent <RaycastingBehaviour>();
 }