public void ResetGround(bool active) { if (active) { if (groundType == GroundType.Roll) { float RollSide = Random.Range(0, 2); if (RollSide == 1) { RightSide = true; } else if (RollSide == 0) { RightSide = false; } Debug.Log(RollSide); } if (groundType == GroundType.Hurt) { if (HurtOnce) { HurtOnce = false; } } this.gameObject.transform.parent = m_GroundCreator; this.gameObject.transform.localPosition = new Vector3(0, 0, 0); groundType = (GroundType)Random.Range(0, 4); StartCoroutine(ReSetGroundCounter(3f)); } }
public ZeptoSprite MakeGround(GroundType gtype, Transform parent, int x, int y) { GameObject go = null; switch (gtype) { case GroundType.OCEAN: go = OceanGround; break; case GroundType.BEACH: go = BeachGround; break; case GroundType.BEACHTOSANDY: go = BeachToSandyGround; break; case GroundType.SANDY: go = SandyGround; break; case GroundType.GRASSY: go = GrassyGround; break; case GroundType.HILLY: go = HillyGround; break; case GroundType.ROCKY: go = RockyGround; break; case GroundType.MOUNTAIN: go = MountainGround; break; default: break; } return(MakeProtoGround(go, parent, x, y)); }
public GroundPlate(GroundType gt, int I, int J) { _type = gt; point = new Point(I, J); _light = 0; _wasLighted = "nn"; }
private void Swallow() { GroundType typeSwallowed = tongueCollider.Swallow(); Debug.Log("Swallowed: " + typeSwallowed.ToString()); if (typeSwallowed == GroundType.poison) { bossScript.atePoison = true; } if (typeSwallowed == GroundType.dirt) { bossScript.ateRock = true; } tongueAnimator.gameObject.SetActive(false); tongueAnimator.SetFloat("TongueExtendDirection", 1.0f); tongueAimIndicator.SetActive(false); if (typeSwallowed != GroundType.none) { AudioManager.Instance.PlaySoundVaried("gulp"); } }
void GroundingUpdate() { //Setup des raycast pour mettre à jour le grounding int numHits = playerCollider.Cast(-Vector2.up, rGroundCast, 0.1f); int wallHitsLeft = playerCollider.Raycast(Vector2.left, rWallCast, 1.4f, wallJumpLayer); int wallHitsRight = playerCollider.Raycast(-Vector2.left, rWallCast, 1.4f, wallJumpLayer); //Grounding au sol if (numHits > 0) { groundType = GroundType.ground; } //Grounding sur un mur de WallJump else if (wallHitsLeft > 0) { print("touché gauche"); groundType = GroundType.wallJump; isLeftWallJump = true; } else if (wallHitsRight > 0) { print("touché droit"); groundType = GroundType.wallJump; isLeftWallJump = false; } //Pas de Grounding (vide) else { groundType = GroundType.none; } }
public Point(Coordinates coordinates, GroundType groundtype, float waterdeep, float height) { this.coordinates = coordinates; this.groundtype = groundtype; this.waterdeep = waterdeep; this.height = height; }
public static AnchorPointList CreateNear(Coordinates center, float radius1, float radius2) { bool rc = false; RGEContext db = new RGEContext(); AnchorPointList anchor_point_list = new AnchorPointList(); using (SqlCommand cmd = new SqlCommand("EGH.GetListAnchorPointOnDistanceLessThanD2MoreThanD1", db.connection)) { cmd.CommandType = CommandType.StoredProcedure; { SqlParameter parm = new SqlParameter("@ШиротаГрад", SqlDbType.Real); parm.Value = center.latitude; cmd.Parameters.Add(parm); } { SqlParameter parm = new SqlParameter("@ДолготаГрад", SqlDbType.Real); parm.Value = center.lngitude; cmd.Parameters.Add(parm); } { SqlParameter parm = new SqlParameter("@Расстояние1", SqlDbType.Real); parm.Value = radius1; cmd.Parameters.Add(parm); } { SqlParameter parm = new SqlParameter("@Расстояние2", SqlDbType.Real); parm.Value = radius2; cmd.Parameters.Add(parm); } try { cmd.ExecuteNonQuery(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { int id = (int)reader["IdТехногенногоОбъекта"]; float x = (float)reader["ШиротаГрад"]; float y = (float)reader["ДолготаГрад"]; int ground_type_code = (int)reader["ТипГрунта"]; int cadastre_type_code = (int)reader["КодНазначенияЗемель"]; float waterdeep = (float)reader["ГлубинаГрунтовыхВод"]; float height = (float)reader["ВысотаУровнемМоря"]; GroundType ground_type = new GroundType(ground_type_code); Coordinates coordinates = new Coordinates((float)x, (float)y); CadastreType cadastre_type = new CadastreType(cadastre_type_code); Point point = new Point(coordinates, ground_type, (float)waterdeep, (float)height); //delta = (float)reader["Расстояние"]; AnchorPoint anchor_point = new AnchorPoint(id, point, cadastre_type); anchor_point_list.Add(anchor_point); } rc = anchor_point_list.Count > 0; reader.Close(); } catch (Exception e) { rc = false; }; return(anchor_point_list); } }
public void SetGroundType(GroundType newGroundType) // GENERATED { if (SetGroundTypeLocal(newGroundType)) // GENERATED { photonView.RPC("SetGroundTypeRPC", PhotonTargets.AllViaServer, newGroundType); // GENERATED } }
// Use this for initialization void Awake() { rigidB = transform.GetComponent <Rigidbody2D>(); skidmarkRenderers = GetComponentsInChildren <TrailRenderer>(); currGroundType = GroundTypeManager.Instance.defaultGroundType; // use the default ground type if no other is found }
public ScalarIO(FIRRTLNode node, string name, IFIRType type) : base(node, name) { if (type is GroundType ground && ground.IsTypeFullyKnown()) { this.Type = ground; } }
public void SetType(IFIRType type) { if (type is GroundType ground && ground.IsTypeFullyKnown()) { Type = ground; } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.tag == "CameraLock") { switch (collision.GetComponent <CameraMovement>().cameraLockType) { case CameraLocked.HorizonalLocked: horizonalLock = true; break; case CameraLocked.VerticalLocked: verticalLock = true; break; case CameraLocked.BothLocked: horizonalLock = true; verticalLock = true; break; } } if (collision.tag == "Ground") { gt = collision.GetComponent <LongGrass>().ReturnGroundType(); } }
//util funcs static float GetSpeedyPathModifier(Player player) { if (!player.IsSwiming() && !player.InInterior()) { GroundType groundtype = GetGroundType(player); if (_speedModifiers.ContainsKey(groundtype)) { _activeStatusText = _groundTypeStrings[groundtype].Value; return(_speedModifiers[groundtype].Value); } //fallback to biome speed Heightmap.Biome playerBiome = player.GetCurrentBiome(); //Handle new biomes "gracefully" if (!_untamedSpeedModifiers.ContainsKey(playerBiome)) { Logger.LogWarning($"New biome {playerBiome.ToString()}. Unsure how to Handle. Falling back to None."); playerBiome = Heightmap.Biome.None; } _activeStatusText = "$biome_" + playerBiome.ToString().ToLower(); if (_biomeTypeStrings.ContainsKey(playerBiome) && _biomeTypeStrings[playerBiome].Value != "default") { _activeStatusText = _biomeTypeStrings[playerBiome].Value; } return(_untamedSpeedModifiers[playerBiome].Value); } return(1.0f); }
public void UpdateStates(GroundType ground_type) { if (!isDead) { if (daysTillDie == 1 && (seed.preferGround & ground_type) != ground_type) { //If on dislike ground and was one day till die, it should die transform.GetChild(curState).gameObject.SetActive(false); transform.GetChild(seed.totalStates).gameObject.SetActive(true); isDead = true; curState = seed.totalStates; } //if on prefer ground and still not the last state yet else if ((seed.preferGround & ground_type) == ground_type && curState < seed.totalStates - 1) { daysTillDie = seed.bearableday; Grow(); if (curState == seed.totalStates - 1) { readyForHarvest = true; } } else if (curState == seed.totalStates - 1) { //If this seed is ready for harvest, then do nothing even not on prefer ground readyForHarvest = true; return; } else { //If seed is not ready for harvest and not on prefer ground, daystilldie should decrease by one. daysTillDie--; } } }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.GetComponent <GroundTypeContainer>() != null && !jumped) { GroundType groundType = other.gameObject.GetComponent <GroundTypeContainer>().groundType; if ((groundType == GroundType.Flat) || (groundType == GroundType.Ramp && other.gameObject.transform.localScale.x < 0)) { walkVelX = 2f; walkVelY = 0f; } else if (groundType == GroundType.Ramp && other.gameObject.transform.localScale.x > 0) { // print("this is working"); //THIS MAKES HIM HOP WHEN HE GOES UP walkVelX = 2f; walkVelY = 0f; //walkVelY = 1.4f; } grounded = true; } else if (other.gameObject.GetComponent <GameOverObjectCollider>() != null) { // print("working"); coll.enabled = false; Explode(); camera.CallCameraShake(); } // else { // grounded = true; // } }
public void ChangeSprite(GroundType type, bool isSpeed = false) { if (background != null) { if ((int)type == 99) { background.sprite = GetSprites[4]; } else if ((int)type == 0) { light.Stop(Color.white); background.sprite = GetSprites[0]; light.gameObject.SetActive(false); } else { background.sprite = GetSprites[0]; light.gameObject.SetActive(true); light.SetFromAndTo(Color.white, colorTransparent); light.PlayForward(System.Convert.ToInt32(!isSpeed)); colorLight.SetFromAndTo(lightColor[(int)type - 1], (lightColor[(int)type - 1] * colorTransparent)); colorLight.PlayForward(System.Convert.ToInt32(!isSpeed)); } } }
public void OpenLight(GroundType gType = GroundType.None, bool isShow = true) { if (isShow) { light.Stop(Color.white); colorLight.Stop(lightColor[(int)gType - 1]); colorLight.SetFromAndTo(lightColor[(int)gType - 1], lightColor[(int)gType - 1] * colorTransparent); light.SetFromAndTo(Color.white, colorTransparent); light.PlayForward(0); colorLight.PlayForward(0); } else { if (gType != GroundType.None) { colorLight.Stop(lightColor[(int)gType - 1]); } else { colorLight.Stop(lightColor[(int)_groundType - 1]); } light.Stop(Color.white); light.gameObject.SetActive(true); } }
public void FlipTile() //When you press A after opening the flip grid { if (selectedTile) { playerControlsManager.ToggleOnGenericUI(); currentTile = groundTilemap.GetTile(new Vector3Int((int)(selectedTile.transform.position.x - 0.5f), (int)(selectedTile.transform.position.y - 0.5f), (int)selectedTile.transform.position.z)) as GroundTile; if (currentTile) { //darkOverlayObject = Instantiate(darkOverlayPrefab, transform); encounterManager.TestGroundType(currentTile.groundType, selectedTile, false); } else { GameObject colliding = testTrigger.GetCollidingGameObject(); if (testTrigger.GetCollidingTileableStatus()) { if (colliding.GetComponent <IInteractable>() != null) { colliding.GetComponent <IInteractable>().Interact(); } GroundType tmpType = colliding.GetComponent <TTileable>().GetTileType(); //darkOverlayObject = Instantiate(darkOverlayPrefab, transform); encounterManager.TestGroundType(tmpType, selectedTile, false); } } } }
public GameObject SwapGround(GameObject thisground, GroundType ground_type) { GameObject newGround = Instantiate(GetGround(ground_type), thisground.transform.position, Quaternion.identity, thisground.transform.parent); SwapGroundInfo(thisground, newGround); Destroy(thisground.gameObject); return(newGround); }
public void SetGround(Vector2 scale, float minDistanceFromScreen, float maxDistanceFromScreen, float velocity, GroundType groundType) { this.transform.localScale = scale; this.minDistanceFromScreen = minDistanceFromScreen; this.maxDistanceFromScreen = maxDistanceFromScreen; this.velocity = velocity; this.groundType = groundType; }
public void setGroundType(GroundType ground) { if (currentground != ground.name) { player.footSteps = ground.audioController; } currentground = ground.name; }
public void SetGroundType(GroundType ground) { if (currentGround != ground.name) { FPC.groundType = ground; currentGround = ground.name; } }
public void ChangeChara(int job) { isChanged = true; _groundType = GroundType.Chara; charaJob = job; _layer = 0; }
public GroundHitInfo(Vector3 pos, Vector3 norm, Transform tran, [CanBeNull] Rigidbody rb, GroundType type) { position = pos; normal = norm; transform = tran; rigid = rb; groundType = type; }
//覆蓋功能用 public void OnCover() { _roundPrevType = _groundType; _groundType = defaultType; ChangeSprite(_groundType); _layer = 0; }
public void setGroundType(GroundType ground) { if (currentGround != ground.name) { FPC.m_FootstepSounds = ground.footstepsounds; currentGround = ground.name; } }
public Segment(string segment, GroundType groundType) { int length = RandomGenerator.Generate(25, 100); TrackSegment = segment; Ground = groundType; Length = length; }
public TilesRepositoryBuilder WithTiles(GroundType groundType, params TilePosition[] positions) { foreach (var position in positions) { _tiles.Add(position, groundType); } return(this); }
public int GetNumberOfPoints(GroundType type) { if (PointTypesValues.ContainsKey(type)) { return(PointTypesValues[type]); } return(0); }
public Ground(int depthLevel, int toughNess, GameObject groundObject, bool mineable, Vector2Int position, GroundType mytype) { this.depthLevel = depthLevel; this.toughNess = toughNess; this.groundObject = groundObject; this.mineable = mineable; this.position = position; this.mytype = GroundType.ground; }
void Update(){ RaycastHit hit; if (transform.GetComponent<CharacterControlls> ().grounded == true) { if (Physics.Raycast (transform.position, -Vector3.up , out hit)) { if (hit.transform.gameObject.GetComponent<MeshRenderer> ()) { tex = hit.transform.gameObject.GetComponent<MeshRenderer> ().material.mainTexture; } if(hit.transform.tag == "Terrain") { tex = getTerrainTextureAt(transform.position); } if (tex != null){ if (tex.name.Contains("Grass")) { groundType = GroundType.Grass; } else if (tex.name.Contains("Rock")) { groundType = GroundType.Rock; } else if (tex.name.Contains("Metal")) { groundType = GroundType.Metal; } else if (tex.name.Contains("Snow")) { groundType = GroundType.Snow; } else if (tex.name.Contains("Sand")) { groundType = GroundType.Sand; } else if (tex.name.Contains("Wood")) { groundType = GroundType.Wood; } } } } if (tex == null) { groundType = GroundType.Nothing; } if (StepTime > 0){ StepTime -= Time.deltaTime; } if (StepTime <= 0) { if (anim.GetFloat("Speed") > 0.1f && transform.GetComponent<CharacterControlls> ().grounded == true) { FootStep(); StepTime = StepSpeed; } } if (GetComponent<CharacterControlls> ().running == true) { StepSpeed = RunSpeed; } else { StepSpeed = WalkSpeed; } if (GetComponent<CharacterControlls> ().crouching == true) { StepSpeed = CrouchSpeed; } }
/// <summary> /// Returns a color value for the hex at that layer. /// </summary> /// <returns>The color value for this layer.</returns> /// <param name="type">The type of layer we want to get the color from.</param> public static Color GroundColor(GroundType type) { switch (type) { case GroundType.Water: return new Color(14/255f, 116/255f, 181/255f); case GroundType.Land: return new Color(0, 255/255f, 159/255f); case GroundType.Mountain: return new Color(156/255f, 126/255f, 126/255f); default: return new Color(255/255f, 0, 255/255f); } }
/// <summary> /// Returns a value used in HexGridGenerator.PlacementAlgorithm that is used to indicate the amount of offset this layer should have towards the middle of the map. /// </summary> /// <param name="type">What type of layer are we talking about.</param> public static float CenterFactor(GroundType type) { switch (type) { case GroundType.Water: return 0f; case GroundType.Land: return 1f; case GroundType.Mountain: return 2.5f; default: return 1f; } }
/// <summary> /// Method that contains the algorithm for placement of a hex. /// </summary> /// <param name="c">The cubecoordiante of the hex you want to get through the algorithm.</param> /// <param name="mapsize">Size of the map.</param> /// <param name="layer">What kind of layer this layer should be.</param> private void PlacementAlgorithm(CubeCoordinate c, sbyte mapSize, GroundType layer) { // Determine the chance this tile has to be placed. This calculation makes sure that tiles closer to the middle have a higher chance to spawn, then we multiply it by a facter determined by the type of layer we are talking about so that we for example have mountains be placed more in the middle of the map. float chance = ( (c.x * c.x) / (3.0f * mapSize * mapSize) + (c.y * c.y) / (3.0f * mapSize * mapSize) + (c.z * c.z) / (3.0f * mapSize * mapSize) ) * (Ground.CenterFactor(layer)); // Perlin noise returns a value between 0.0-1.0 if (Mathf.Clamp(Mathf.PerlinNoise ( _randomMultiplier * (c.x + mapSize), _randomMultiplier * (c.y + mapSize)), 0f, 1f) >= chance) { PlaceHex(c, layer); } }
/// <summary> /// Creates one layer of hexagons using a few other methods (PlacementAlgorithm and PlaceHex). /// </summary> /// <param name="mapsize">Size of the map.</param> /// <param name="layer">What kind of layer this layer should be.</param> private void CreateLayer(sbyte mapSize, GroundType layer) { // create a world of size 'mapsize' in each direction (x, y, z) for (sbyte x = (sbyte) -mapSize; x <= mapSize; x++) { for (sbyte y = (sbyte) -mapSize; y <= mapSize; y++) { // the z value has to be determined by the x and y sbyte z = (sbyte)(-x - y); // check if the z value also listens to the grid size if (z >= -mapSize && z <= mapSize) { CubeCoordinate coordinate = new CubeCoordinate (x, y, z); PlacementAlgorithm(coordinate, mapSize, layer); } } } }
/// <summary> /// Creates a hexagon at an axial position /// </summary> /// <returns>The created hexagon.</returns> /// <param name="a">The axial coordinate to place the hexagon on to.</param> /// <param name="type">The type of hexagon that should be placed</param> public Hexagon CreateHexagon(CubeCoordinate c, GroundType type) { GameObject hObj = GameObject.Instantiate( HexagonPrefab, HexCalculation.HexToWorld(c), HexagonPrefab.transform.rotation) as GameObject; Color tileColor = Ground.GroundColor(type); HexController hCon= hObj.GetComponent<HexController>(); hCon.SetColor (tileColor); hObj.transform.SetParent (this.gameObject.transform); return new Hexagon (c, type, hCon); }
// Returns the coeffecient of friction for the ground public static float GetCoeff(bool isGrounded, GroundType type) { if (!isGrounded) { // If Jumping return COEFF_AIR; } else { switch (type) { case GroundType.Regular: return COEFF_GROUND; case GroundType.Slippery: return COEFF_SLIPPERY; case GroundType.Sticky: return COEFF_STICKY; } } return COEFF_GROUND; }
void DetermineGroundType() { RaycastHit hit; if (Physics.Raycast(transform.position - Vector3.up * 100f, Vector3.up, out hit, 200f, LayerMask.GetMask("GroundType"))) { GroundTypeArea gta = hit.collider.GetComponent<GroundTypeArea>(); currentGroundType = gta.groundType; } else { currentGroundType = DEFAULT_GROUND_TYPE; } foreach (GoundTypeToSound gtts in sounds) { if (gtts.ground == currentGroundType) { currentFootsteps = gtts.sounds; } } }
public Ground(World world, PolygonF polygon, GroundType type) { this.shape = polygon; this.type = type; UserData userData = new UserData(); userData.thing = this; Vertices vertices = new Vertices(polygon.points); Body body = BodyFactory.CreateBody(world, userData); Fixture fixture = body.CreateFixture(new PolygonShape(vertices, GroundConstants.DENSITY), userData); fixture.Friction = GroundConstants.FRICTION; body.IsStatic = true; if (type == GroundType.Miasma) { body.IsSensor = true; } }
void Start() { previousPosition = transform.position.sety(0); direction = transform.TransformDirection(localWalkingDirection).normalized; toStep = distancePerStep / 0.5f; currentGroundType = DEFAULT_GROUND_TYPE; }
/// <summary> /// Places a hex after it has been through the algorithm (PlacementAlgorithm). It determines what kind of hex it should be and calls the right method for placement of that type of hex. /// </summary> /// <param name="c">The cubecoordiante of the hex you want to get through the algorithm.</param> /// <param name="layer">What kind of layer this layer should be.</param> private void PlaceHex(CubeCoordinate c, GroundType layer) { switch (layer) { case GroundType.Water: CreateWaterHex(c); break; case GroundType.Land: CreateLandHex(c); break; case GroundType.Mountain: CreateMountainHex(c); break; } }
/// <summary>Initializes a new instance of the Ground class using specified points and type.</summary> /// <param name="points">Points.</param> /// <param name="type">Type.</param> public Ground(IEnumerable<Point> points, GroundType type) { Points = new List<Point>(); Points.AddRange(points); Type = type; }
/// <summary> /// Set the ground we are walking on. /// </summary> /// <param name="groundType">Type of the ground</param> void SetGroundType(GroundType groundType) { //Debug.Log("SET TYPE " + groundType); switch (groundType) { case GroundType.DEFAULT: chosenClips = defaultClips; break; case GroundType.ROCK: chosenClips = rockClips; break; case GroundType.SAND: chosenClips = sandClips; break; case GroundType.GRASS: chosenClips = grassClips; break; case GroundType.ASPHALT: chosenClips = asphaltClips; break; case GroundType.CONCRETE: chosenClips = concreteClips; break; } }
/// <summary> /// 장애물 요소 파괴. /// </summary> public void DestroyObstacle() { groundType = GroundType.normal; groundRender.gameObject.SetActive(false); }
public Hexagon (CubeCoordinate c, GroundType type, HexController controller) : base (c) { WorldPos = HexCalculation.HexToWorld (CubePos); occupied = (type != GroundType.Land); _hexType = type; _controller = controller; if (occupied) _controller.SetIndicatorColor(new Color(1f,1f,1f,0.1f)); }