Inheritance: MonoBehaviour
 // Use this for initialization
 void Start()
 {
     copyGC = gridObject.GetComponent<GridController>();
     copyVS = vertexSpawnerObject.GetComponent<VertexSpawner>();
     copySC = selectorControllerObject.GetComponent<SelectorController>();
     copyGG = cameraObject.GetComponent<GloblGUI>();
     copyEC = cameraObject.GetComponent<ExportController>();
 }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        grid = GameObject.FindGameObjectWithTag("Grid").GetComponent<GridController>();

        actualTime = startTime + offsetForSlider;
        newStartTime = startTime + offsetForSlider;

        timerSlider = GameObject.FindGameObjectWithTag("Timer").GetComponent<Slider>();
        timerSlider.maxValue = startTime + offsetForSlider;
        timerSlider.value = actualTime + offsetForSlider;
    }
Exemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        LoadPrefs();
        isGridButton = true;
        isSelectButton = true;
        isMoveButton = false;
        isRotateButton = false;
        isBridgeButton = false;
        paramsButtonZone = new Rect(padding, padding, squareSize, squareSize);
        showGridButton = new Rect(padding, squareSize + 2*padding, squareSize, squareSize);
        newVertexRect = new Rect(padding, 2*(squareSize + padding) + padding, squareSize, squareSize);
        selectButtonZone = new Rect(padding, 3 * (squareSize + padding) + padding, squareSize, squareSize);
        moveButtonZone = new Rect(padding, 4 * (squareSize + padding) + padding, squareSize, squareSize);
        rotateButtonZone = new Rect(padding, 5 * (squareSize + padding) + padding, squareSize, squareSize);
        bridgeButtonZone = new Rect(padding, 6 * (squareSize + padding) + padding, squareSize, squareSize);
        clearButtonZone = new Rect(padding, 7 * (squareSize + padding) + padding, squareSize, squareSize);
        exportButtonZone = new Rect(padding, 8 * (squareSize + padding) + padding, squareSize, squareSize);

        moveMenusZone = new Rect(Screen.width - 3*padding - valueLength - contentLength, padding, 2*padding + valueLength + contentLength, titleHeight + 4*padding + 3*valueHeight);
        rotateMenusZone = new Rect(Screen.width - 3 * padding - valueLength - contentLength, padding, 2 * padding + valueLength + contentLength, titleHeight + 4 * padding + 3 * valueHeight);
        moveRotateTitleZone = new Rect(0, 0, moveMenusZone.width, titleHeight);//relative
        moveRotateContentZone = new Rect(padding, padding + moveRotateTitleZone.height, moveMenusZone.width - 2*padding, 2*padding + 3*valueHeight);

        StatusLineZone = new Rect(0, Screen.height - statusHeight, Screen.width, statusHeight);

        allScreenZone = new Rect(0, 0, Screen.width, Screen.height);
        paramsWindowZone = new Rect((Screen.width - paramsWindowWidth)/2, (Screen.height - paramsWindowHeight)/2, paramsWindowWidth, paramsWindowHeight);
        //closeParamsWindowButtonZone = new Rect(paramsWindowZone.xMax - closeButtonSize / 2, paramsWindowZone.yMin - closeButtonSize / 2, closeButtonSize, closeButtonSize);
        closeParamsWindowButtonZone = new Rect(paramsWindowZone.xMax, paramsWindowZone.yMin - closeButtonSize, closeButtonSize, closeButtonSize);
        toolbarZone = new Rect(0, 0, paramsWindowZone.width, toolbarHeight);//relative
        //settingsContentZone = new Rect(padding, padding + toolbarHeight, paramsWindowZone.width - 2*padding, paramsWindowZone.height - 2 * padding - toolbarHeight);//relative
        settingsContentZoneCentered = new Rect((paramsWindowZone.width - (float)centerZoneWidth) / 2, padding + toolbarHeight,centerZoneWidth, paramsWindowZone.height - 2 * padding - toolbarHeight);

        copyGC = gridObject.GetComponent<GridController>();
        copyVS = vertexSpawnerObject.GetComponent<VertexSpawner>();
        copySC = selectorObject.GetComponent<SelectorController>();
        copyEC = gameObject.GetComponent<ExportController>();

        paramsContentC = new GUIContent(paramsImgC);
        paramsContentG = new GUIContent(paramsImgG);
        xContentG = new GUIContent(xImgG);
        xContentC = new GUIContent(xImgC);
        gridContentC = new GUIContent(gridImgC);
        gridContentG = new GUIContent(gridImgG);
        selectContentC = new GUIContent(selectImgC);
        selectContentG = new GUIContent(selectImgG);
        moveContentC = new GUIContent(moveImgC);
        moveContentG = new GUIContent(moveImgG);
        rotateContentC = new GUIContent(rotateImgC);
        rotateContentG = new GUIContent(rotateImgG);
        bridgeContentC = new GUIContent(bridgeImgC);
        bridgeContentG = new GUIContent(bridgeImgG);
        vertexContentC = new GUIContent(vertexImgC);
        vertexContentG = new GUIContent(vertexImgG);
        clearContentC = new GUIContent(clearImgC);
        clearContentG = new GUIContent(clearImgG);
        exportContentC = new GUIContent(exportImgC);
        exportContentG = new GUIContent(exportImgG);

        keyString = FormKeyString();

        paramsCameraSpeed = GlobalParameters.cameraSpeed / 8.0f;
        paramsMoveStep = GlobalParameters.moveStep;
        paramsRotateStep = GlobalParameters.rotateStep;
        paramsGridSize = GlobalParameters.gridSize;
        copyGC.SetSize(paramsGridSize);
        paramCurveStep = GlobalParameters.curveSteps;
        paramUseImgEffect = GlobalParameters.useImgEffect;
        paramLightining = GlobalParameters.lightining;
        paramBloomIntensity = GlobalParameters.bloomIntensity;
        paramUseAntialiasing = GlobalParameters.useAntialiasing;
        paramUseSSAO = GlobalParameters.useSSAO;

        gameObject.GetComponent<CameraController>().LoadParameters();
        copyVS.UpdateBridgeCurveSteps();
    }
Exemplo n.º 4
0
 void Awake()
 {
     grid = GameObject.Find("Grid").GetComponent<GridController>();
     //ewc = GameObject.Find("SpinWheel").GetComponent<EditorWheelController>();
     sr = GameObject.Find("InvScroll").GetComponent<ScrollRect>();
     iwc = GameObject.Find("InvContent").GetComponent<InventoryWindowController>();
     canvas = GameObject.Find ("Canvas").GetComponent<Canvas>();
     overlaysLayer = GameObject.Find("Overlays").GetComponent<RectTransform>();
     piecesLayer = GameObject.Find("Pieces").GetComponent<RectTransform>();
 }
Exemplo n.º 5
0
    // ArrayList Item;  // For Items
    // Use this for initialization
    void Start()
    {
        // Set the transform and the position of the unit
        tr = transform;
        pos = tr.position;
        oldPos = pos;

        plannedPath = new char[agility];

        // Get the needed scripts script
        arrowScript = (Arrows) tr.GetChild (1).GetComponent( "Arrows" );
        anima = (Animator) tr.GetComponent ("Animator");
        gridScript = (GridController) GameObject.Find ("GridMaster").GetComponent("GridController");

        speed = Random.Range (1, 99);
    }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        /*pos = transform.position;
        tr = transform;
        print ("Guard Position at start = (" + pos.x + ", " + pos.y + ")");
        players = GameObject.FindGameObjectsWithTag("Player");
        start_x = pos.x;
        start_y = pos.y;
        Light[] lights = GetComponentsInChildren<Light> ();
        spotlight = lights [0];
        Transform[] transforms = GetComponentsInChildren<Transform> ();*/

        //Get all the children components
        //There should only be one light per guard
        //If that changes, change this
        FlashLight = GetComponentInChildren<Light>();

        //Get the grid controller
        gridController = (GridController)GameObject.FindGameObjectWithTag("Grid").GetComponent("GridController");

        //Get all active players in the entire game
        ActivePlayerList = GameObject.FindGameObjectsWithTag("Player");

        hasPath = 0;
        TurnsSpentChasingPlayer = 0;
        ReturningToPath = 0;

        print ("PLAYERS FOUND:");
        foreach(GameObject player in ActivePlayerList){
            print(player);
        }

        if (GuardRoute[0].x != 0.0 && GuardRoute[0].y != 0.0) {
            transform.position = (Vector3)GuardRoute[0];
        }

        ChosenVictim = null;

        //GuardRoute[0] = (Vector2)transform.position;
        //GuardRoute[1] = GuardRoute[0] + new Vector2(500, 0);
        //RouteCount = 2;
        CurrentRouteIndex = 1;
        DetectsPlayer = false;
    }
Exemplo n.º 7
0
    void Awake()
    {
        if (instance == null){
            instance = this;
            gridSegments = new List<GridSegment>();

            lastMoveTime = Time.time;
        }
        else{
            Destroy(this.gameObject);
            Debug.Log("lol");
        }
    }
Exemplo n.º 8
0
    // Use this for initialization
    /*public Level(GridController grid, GameObject tileObject)
    {
        this.grid = grid;

        // Receive passed tile object
        this.tileObject = tileObject;

        levelDim = new Dimension(12,12);
        grid.initializeLevel(levelDim);

        initLevel ();
    }*/
    void Start()
    {
        GameObject gridResource =  (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Grid"));

        grid=gridResource.GetComponent(typeof(GridController)) as GridController;
        levelDim= new Dimension(10,10);
        grid.initializeLevel(levelDim);
        initLevel();
    }
Exemplo n.º 9
0
 public void setVel(int x, int y)
 {
     if(_canMove)
     {
     _vel.x=x;
     _vel.y=y;
         if(!(x==0 &&y==0)){
             //TODO:
             //because of how untiy instantiated prefabs, sometimes the GridCOntroller is not available when this object instantiates. This fetches it whenver it is needed.
             //Im assuming this in not very efficient.
             grid=(GridController)GameObject.FindObjectOfType(typeof(GridController));
         grid.resolveMovement(this);
         }
     }
 }
Exemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        tr = transform;

        GameObject thisUnit = tr.parent.transform.gameObject;
        GameObject grid = GameObject.FindGameObjectWithTag ("Grid");

        unitScript = (Unit) thisUnit.GetComponent("Unit");
        gridScript = (GridController)grid.GetComponent ("GridController");

        pos = thisUnit.transform.position;
        agility = unitScript.getAgility();

        plannedPath = new char[agility];
        pipelineArrows = new GameObject[agility];
    }
 void OnEnable()
 {
     mController = (GridController)this.target;
 }
Exemplo n.º 12
0
    private void OnMouseDrag()
    {
        if (Lock)
        {
            return;
        }

        if (_timeRemaining <= 0)
        {
            OnMouseUp();
            return;
        }

        float remaining = 1 - (Duration.DragTime - _timeRemaining) / Duration.DragTime;

        ObjectHooks.TimerBar.value      = remaining;
        ObjectHooks.TimerBarImage.color = Color.Lerp(Color.red, Color.white, _timeRemaining / 5);
        Vector3 m = Input.mousePosition;

        if ((int)_mOld.x == (int)m.x && (int)_mOld.y == (int)m.y)
        {
            return;
        }

        _mOld = m;
        m     = CameraController.Main.ScreenToWorldPoint(m);

        float x = m.x;
        float y = m.y;

        if (x < Bounds.X0)
        {
            x = Bounds.X0;
        }
        else if (x > Bounds.X1)
        {
            x = Bounds.X1;
        }

        if (y < Bounds.Y0)
        {
            y = Bounds.Y0;
        }
        else if (y > Bounds.Y1)
        {
            y = Bounds.Y1;
        }

        Vector2 pos = new Vector2(x, y);

        _hoverOverPos         = Interpolate(pos);
        _parent.localPosition = pos;

        if (_hoverOverPos == _initialPos)
        {
            return;
        }

        // If diagonal movement was made without registering corner tiles
        if ((int)_hoverOverPos.x != (int)_initialPos.x && (int)_hoverOverPos.y != (int)_initialPos.y)
        {
            // Skipped tile
            GridController.Swap(new Vector2(_initialPos.x, _hoverOverPos.y), _initialPos);

            // Tile diagonal to the empty spot
            GridController.Swap(_hoverOverPos, new Vector2(_initialPos.x, _hoverOverPos.y));
        }
        else
        {
            GridController.Swap(_hoverOverPos, _initialPos);
        }

        _initialPos = _hoverOverPos;
    }
Exemplo n.º 13
0
    void Start()
    {
        grid = GameObject.FindGameObjectWithTag("Grid").GetComponent<GridController>();

        mouseSnapForce = grid.mouseSnapForce;
        maxSnapForce = grid.maxSnapForce;
    }
Exemplo n.º 14
0
 public override void Initialize()
 {
     gridController = grid.GetComponent <GridController>();
 }
Exemplo n.º 15
0
 void Awake()
 {
     grid           = GameObject.FindGameObjectWithTag("Grid").GetComponent <GridController>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     paths          = new List <UpdatePath>();
 }
Exemplo n.º 16
0
 private void OnTileclickedUp(HexTile hexTile)
 {
     Debug.Log("mouse up");
     GridController.ResetAllTiles();
 }
Exemplo n.º 17
0
 public GridLocation(int x, int y)
 {
     this.x           = x;
     this.y           = y;
     this.anchorpoint = GridController.GetWorldPosition(x, y);
 }
Exemplo n.º 18
0
 public void Start()
 {
     this.maximumBoundsOfPlayingField = GridController.getMaximumBoundsOfPlayingField();
 }
Exemplo n.º 19
0
 /*
  * dans monster spawn
  public void WannaCreateMob(Player_Board.e_monster mob, Player_Board.e_player player){
     UpgradeMonsters.Stats info = GameObject.Find ("Board").GetComponent<UpgradeMonsters> ().getNewStats (mob, 1);
     if (playerBoard.money >= info.cost) {
         CmdCreateMob (mob, player);
         GameObject.Find ("GameInterfaces").GetComponent<PopUpMessages>().DisplayMessage("you created a monster", 1);
     }
     else
         GameObject.Find ("GameInterfaces").GetComponent<PopUpMessages>().DisplayMessage("Not enough money", 1);
 }
 */
 void Start()
 {
     timers = GameObject.Find ("GameInterfaces").GetComponent<TimerAndIncome> ();
     gridController = GameObject.Find("GridController").GetComponent<GridController>();
 }
 // Use this for initialization
 void Start()
 {
     GameObject theGrid = GameObject.Find("Grid");
     control = theGrid.GetComponent<GridController>();
     if (gameObject.name.Length == 9)
     {
         whatNum = int.Parse(gameObject.name.Substring(7, 1));
     }
     else if (gameObject.name.Length == 10)
     {
         whatNum = int.Parse(gameObject.name.Substring(7, 2));
     }
     else
     {
         whatNum = 0;
     }
     //Heesoo is a God
     Shot = false;
     direction = 1f;
 }
Exemplo n.º 21
0
    public void Start()
    {
        grid = GameObject.Find("Grid").GetComponent<GridController>();
        ewc = GameObject.Find("SpinWheel").GetComponent<EditorWheelController>();
        sr = GameObject.Find("InvScroll").GetComponent<ScrollRect>();
        iwc = GameObject.Find("InvContent").GetComponent<InventoryWindowController>();
        canvas = GameObject.Find ("Canvas").GetComponent<Canvas>();
        //grid.editor = this;

        EventManager em = EventManager.Instance();
        em.RegisterForEventType("piece_tapped",this);
        em.RegisterForEventType("template_tapped",this);
        em.RegisterForEventType("piece_dropped_on_inventory",this);

        GameObject go = Instantiate (Resources.Load ("Prefabs/ExistingPiece")) as GameObject;
        go.transform.SetParent(canvas.transform,false);
        go.transform.position = new Vector3(go.transform.position.x-2,go.transform.position.y,go.transform.position.z);
        floatingPiece = go.GetComponent<PieceController>();
        floatingPiece.ConfigureFromJSON("penetration_normal");
        floatingPiece.SetRotation(180);

        ewc.transform.rotation = floatingPiece.transform.rotation;
    }
Exemplo n.º 22
0
	void OnAwake() {
		instance = this;
	}
Exemplo n.º 23
0
 //the physics engine does a collide the instant a tile wants to move into a space.
 //some actions need to wait until the movement of said tile is complete before triggering.
 //because of this, we have created another kind of collision that needs to be defined by the object animating.
 public void movementComplete()
 {
     grid=(GridController)GameObject.FindObjectOfType(typeof(GridController));
         grid.doOverCollide(this);
 }
Exemplo n.º 24
0
 private void Awake()
 {
     Singelton = this;
 }
Exemplo n.º 25
0
    void Start()
    {
        //does start get called more than once? SOmething like that. Was breaking my stuff. So I needed to instantiate  _point up above.
        //__pos=new Point(0,0);

        //_dim=

        grid=(GridController)GameObject.FindObjectOfType(typeof(GridController));
    }
Exemplo n.º 26
0
 // Use this for initialization
 void Start()
 {
     gridController = GameObject.Find("Grid").GetComponent <GridController>();
 }