public void SetFall(float _height, Vector3 _flyDir, float speed, float height) { //float ground_height = _height; f_fallTime = 2.0f * _height / f_gravity; origin_pos_vec3 = transform.position; b_falling = true; collider.enabled = false; fly_dir_vec3 = new Vector3(speed * _flyDir.x, speed * _flyDir.y, 0); add_velocity_vec3 = new Vector3(0.0f, -f_gravity, 0.0f); shadowRender.enabled = false; levelHeight.SetSpecificHeight(height); }
public override void SetOn(bool _isOuT, Action _callBack) { Debug.Log("set is out"); isForOut = _isOuT; callBack = _callBack; if (isForOut) { levelHieght.SetSpecificHeight(-100.0f); } else { levelHieght.SetSpecificHeight(0.0f); } }
public void MakePoisonOver() { float angle = -20.0f; float dst = 2.0f; //RaycastHit2D detect = Physics2D.Raycast(new Vector2(playerPos.x , playerPos.y), new Vector2(-1.0f,0.0f),4.0f); //RaycastHit2D detect2 = Physics2D.Raycast(new Vector2(playerPos.x, playerPos.y), new Vector2(1.0f, 0.0f), 4.0f); bool detectWall = (playerPos.y > -4.3f && playerPos.y < 2.6f && (playerPos.x <-11.3f || playerPos.x> 11.3f)) ? true : false; if (detectWall) { //float nearRight = ((playerPos.x - detect1.transform.position.x) > (detect2.transform.position.x - playerPos.x)) // ? -1.0f : 1.0f; if (Random.Range(0.0f, 1.0f) > 0.5f) { poisonOffset = new Vector3(0.0f, 1.0f, 0.0f); } else { poisonOffset = new Vector3(0.0f, -1.0f, 0.0f); } } else { if (Random.Range(0.0f, 1.0f) > 0.5f) { poisonOffset = new Vector3(1.0f, 0.0f, 0.0f); } else { poisonOffset = new Vector3(-1.0f, 0.0f, 0.0f); } } poisonAtksPos[0] = playerPos + new Vector3(0.0f, 0.5f, 0.0f); poisonAlerts.AddUsed(poisonAtksPos[0]); for (int i = 1; i < 4; i++) { poisonAtksPos[i] = poisonAtksPos[0] + (Quaternion.AngleAxis(angle, Vector3.forward) * poisonOffset * dst); dst += 1.0f; poisonAlerts.AddUsed(poisonAtksPos[i]); angle *= -1; } Vector3 tempSelfPos = Vector3.zero; if (Mathf.Abs(poisonOffset.y) > 0.5f) { if (poisonOffset.y > 0.0f) { tempSelfPos = new Vector3(poisonAtksPos[0].x - 1.0f, poisonAtksPos[0].y - 1.0f, transform.position.z); } else { tempSelfPos = new Vector3(poisonAtksPos[0].x + 1.0f, poisonAtksPos[0].y + 1.0f, transform.position.z); } } else { if (poisonOffset.x > 0.0f) { tempSelfPos = new Vector3(poisonAtksPos[0].x - 1.0f, poisonAtksPos[0].y + 1.0f, transform.position.z); } else { tempSelfPos = new Vector3(poisonAtksPos[0].x - Mathf.Sign(poisonOffset.x), poisonAtksPos[0].y + 1.0f, transform.position.z); } } transform.position = tempSelfPos; transform.localScale = new Vector3(-Mathf.Sign(poisonOffset.x), 1.0f, 1.0f); levelHieght.SetSpecificHeight(-110.0f); }