private Gamelogic _logic; // Gamelogic component attached to the Game Logic Game Object // Use this for initialization void Start() { // Get tagged Game Objects BallTrack = GameObject.FindGameObjectWithTag("CAM_BALL_TRACK"); BallFollow = BallTrack.transform.GetChild(0).gameObject; Cam = GameObject.FindGameObjectWithTag("MainCamera"); Cam_Top_Right = GameObject.FindGameObjectWithTag("CAM_TOPRIGHT"); Cam_Top_Left = GameObject.FindGameObjectWithTag("CAM_TOPLEFT"); Cam_Lower_Board = GameObject.FindGameObjectWithTag("CAM_LOWERBOARD"); GAMELOGIC = GameObject.FindGameObjectWithTag("GAMELOGIC"); // Get the Gmaelogic component on the Game Logic Game Object _logic = GAMELOGIC.GetComponent <Gamelogic> () as Gamelogic; // Set the Ball Game Object to the Active Ball from Game Logic Ball = _logic.ActiveBall; // Get the tranforms from Game Objects Trans_BallTrack = BallTrack.transform; Trans_BallFollow = BallTrack.transform; Trans_Ball = Ball.transform; Trans_Cam = Cam.transform; Trans_Marker_BottomRight_Top = Marker_BottomRight_Top.transform; Trans_Marker_TopRight_Left = Marker_TopRight_Left.transform; Trans_Marker_TopRight_Bottom = Marker_TopRight_Bottom.transform; Trans_Marker_TopLeft_Bottom = Marker_TopLeft_Bottom.transform; Trans_Marker_Launch = Marker_Launch.transform; Trans_Cam_Top_Right = Cam_Top_Right.transform; Trans_Cam_Top_Left = Cam_Top_Left.transform; Trans_Cam_Lower_Board = Cam_Lower_Board.transform; }
//GameObject active; // Use this for initialization void Start() { var gameObject = GameObject.Find("Core"); game = (Gamelogic)gameObject.GetComponent(typeof(Gamelogic)); // active = game.activeKeyHandler; }
void CheckCollision() { var gameObject = GameObject.Find("_Game"); Gamelogic gl = (Gamelogic)gameObject.GetComponent(typeof(Gamelogic)); var myPos = gl.GetMyCoordinates(myX, myY, myZ); //var myPos = new Vector3(0,0,0); // space objecet listaa vois pitää vaikka gamelogic niin ei tarttis aina hakee foreach (SpaceObject o in gl.SpaceObjects) { if (o == this) { continue; } // haetaan pelikoordinaatit, että voidaan käyttää unityn ominaisuuksia var oPos = gl.GetMyCoordinates(o.myX, o.myY, o.myZ); // TODO: tähän väliin tsekata kunnolla collision var distance = Vector3.Distance(oPos, myPos); //Debug.Log(distance); if (distance < radius) { //Debug.Log("Collision "); o.OnCollision(this); } } }
public void Start() { map = new SimpleLayeredMap<PointyHexPoint>(new PointyHexMap(new Vector2(69, 80)*5f), 200, 0); var shapes = new [] { PointyHexGrid<Block>.BeginShape().Hexagon(6), PointyHexGrid<Block>.BeginShape().Hexagon(5), PointyHexGrid<Block>.BeginShape().Hexagon(4), PointyHexGrid<Block>.BeginShape().Hexagon(3), PointyHexGrid<Block>.BeginShape().Hexagon(2), PointyHexGrid<Block>.BeginShape().Hexagon(1) }; grid = LayeredGrid<Block, PointyHexPoint>.Make< PointyHexShapeInfo<Block>, PointyHexGrid<Block>, PointyHexPoint, PointyHexPoint, PointyHexOp<Block>>(shapes); foreach (LayeredPoint<PointyHexPoint> point in grid) { var cell = Instantiate(cellPrefab); cell.transform.parent = transform; cell.transform.localPosition = map[point]; var color = ExampleUtils.Colors[(point.Point.GetColor1_3()) + 4]; cell.renderer.material.color = color; cell.name = point.ToString(); grid[point] = cell; } }
private Gamelogic _logic; // Gamelogic component attached to the Game Logic Game Object #endregion Fields #region Methods // Use this for initialization void Start() { // Get tagged Game Objects BallTrack = GameObject.FindGameObjectWithTag ("CAM_BALL_TRACK"); BallFollow = BallTrack.transform.GetChild (0).gameObject; Cam = GameObject.FindGameObjectWithTag ("MainCamera"); Cam_Top_Right = GameObject.FindGameObjectWithTag ("CAM_TOPRIGHT"); Cam_Top_Left = GameObject.FindGameObjectWithTag ("CAM_TOPLEFT"); Cam_Lower_Board = GameObject.FindGameObjectWithTag ("CAM_LOWERBOARD"); GAMELOGIC = GameObject.FindGameObjectWithTag ("GAMELOGIC"); // Get the Gmaelogic component on the Game Logic Game Object _logic = GAMELOGIC.GetComponent<Gamelogic> () as Gamelogic; // Set the Ball Game Object to the Active Ball from Game Logic Ball = _logic.ActiveBall; // Get the tranforms from Game Objects Trans_BallTrack = BallTrack.transform; Trans_BallFollow = BallTrack.transform; Trans_Ball = Ball.transform; Trans_Cam = Cam.transform; Trans_Marker_BottomRight_Top = Marker_BottomRight_Top.transform; Trans_Marker_TopRight_Left = Marker_TopRight_Left.transform; Trans_Marker_TopRight_Bottom = Marker_TopRight_Bottom.transform; Trans_Marker_TopLeft_Bottom = Marker_TopLeft_Bottom.transform; Trans_Marker_Launch = Marker_Launch.transform; Trans_Cam_Top_Right = Cam_Top_Right.transform; Trans_Cam_Top_Left = Cam_Top_Left.transform; Trans_Cam_Lower_Board = Cam_Lower_Board.transform; }
// Use this for initialization void Start() { // Get the ConstantForce component, Game Logic Game Object, and Gamelogic component _force = GetComponent<ConstantForce> () as ConstantForce; GAMELOGIC = GameObject.FindGameObjectWithTag ("GAMELOGIC"); _logic = GAMELOGIC.GetComponent<Gamelogic> () as Gamelogic; }
private Gamelogic _logic; // Gamelogic component on Game Logic Game Object // Use this for initialization void Start() { // Get the ConstantForce component, Game Logic Game Object, and Gamelogic component _force = GetComponent <ConstantForce> () as ConstantForce; GAMELOGIC = GameObject.FindGameObjectWithTag("GAMELOGIC"); _logic = GAMELOGIC.GetComponent <Gamelogic> () as Gamelogic; }
// Update is called once per frame void FixedUpdate() { // haetaan pelin koordinaatiston paikkatieto pelilogiikalta. var gameObject = GameObject.Find("_Game"); Gamelogic gl = (Gamelogic)gameObject.GetComponent(typeof(Gamelogic)); var newcoordinates = gl.GetMyCoordinates(myX, myY, myZ); transform.position = newcoordinates; }
public void UpdatePosition() { var gameObject = GameObject.Find("_Game"); Gamelogic gl = (Gamelogic)gameObject.GetComponent(typeof(Gamelogic)); var newcoordinates = gl.GetMyCoordinates(myX, myY, myZ); if (newcoordinates != lastCoordinates) { CheckCollision(); } transform.position = newcoordinates; }
public void RegisterToGame(bool remove) { coreObject = GameObject.Find("Core"); if (coreObject == null) { return; } Gamelogic gl = (Gamelogic)coreObject.GetComponent(typeof(Gamelogic)); if (remove) { gl.DeregisterSpaceObject(this); } else { gl.RegisterSpaceObject(this); } }