public void Initialize() { // Finding GameObjects m_object_player = GameObject.Find("Player"); m_object_helpers = GameObject.Find ("Helpers"); m_object_duckfield = GameObject.Find("Duckfield"); m_object_audio = GameObject.Find("Audio"); m_object_cameraman = GameObject.Find("Main Camera"); // Finding Components m_collision_prober = m_object_player.GetComponent<CollisionProber>(); m_scoring = m_object_player.GetComponent<Scoring>(); m_health = m_object_player.GetComponent<Health>(); m_walker = m_object_player.GetComponent<Walker>(); m_jumper = m_object_player.GetComponent<Jumper>(); m_time_helper = m_object_helpers.GetComponent<TimeHelper>(); m_screen_helper = m_object_helpers.GetComponent<ScreenHelper>(); m_duckfield = m_object_duckfield.GetComponent<DuckField>(); m_duckization = m_object_audio.GetComponent<DuckizationController>(); m_cameraman = m_object_cameraman.GetComponent<Cameraman>(); m_ig_menu = m_object_cameraman.GetComponent<IgMenu>(); }
public void RemoveRange(int index, int count) { if ((index + count) <= _instructions.Count) { for (int i = 0; i < count; i++) { ASInstruction instruction = _instructions[index]; _indices.Remove(instruction); _instructions.RemoveAt(index); List <ASInstruction> group = _opGroups[instruction.OP]; if (group.Count == 1) { _opGroups.Remove(instruction.OP); } else { group.Remove(instruction); } // TODO: Recalibrate switch exits. Jumper entry = GetJumperEntry(instruction); if (entry != null) { if (index != _instructions.Count) { ASInstruction exit = _instructions[index]; JumpExits[entry] = exit; } else { JumpExits[entry] = null; } } if (Jumper.IsValid(instruction.OP)) { JumpExits.Remove((Jumper)instruction); } else if (instruction.OP == OPCode.LookUpSwitch) { SwitchExits.Remove((LookUpSwitchIns)instruction); } } for (int i = index; i < _indices.Count; i++) { ASInstruction toPull = _instructions[i]; _indices[toPull] -= count; } } }
/// <summary> /// Добавить новый джампер в БД /// </summary> /// <param name="jumper">добавляемый джампер</param> private void AddJumperToDb(Jumper jumper) { using (var ctx = new CVDbContext(AppDataPath)) { ctx.EpisodeOptions .First(eo => eo.EpisodeOptionId == SelectedEpisodeOption .EpisodeOptionId).Duration = CalculatingDuration(); ctx.Jumpers.Add(jumper); ctx.SaveChanges(); Jumpers.Last().JumperId = ctx.Jumpers.ToList().Last().JumperId; NotifyOfPropertyChange(() => Jumpers); } }
IEnumerator Jump(Tile to) { Tweener tweener = transform.MoveTo(to.GridTileCenter, 0.5f, EasingEquations.Linear); Tweener tweener2 = Jumper.MoveToLocal(new Vector3(0, to.HexHeight * to.height, 0), tweener.easingControl.duration / 2f, EasingEquations.EaseOutQuad); tweener2.easingControl.loopCount = 1; tweener2.easingControl.loopType = EasingControl.LoopType.PingPong; while (tweener != null) { yield return(null); } }
public static bool CanJump(this Jumper jumper, ControlType controlType) { switch (jumper.GetJumperType()) { case JumperType.VoidReturn: switch (controlType) { case ControlType.Method: return(true); default: return(false); } case JumperType.Return: switch (controlType) { case ControlType.Function: return(true); default: return(false); } case JumperType.Breaker: switch (controlType) { case ControlType.Switch: case ControlType.Loop: return(true); default: return(false); } case JumperType.Continue: switch (controlType) { case ControlType.Loop: return(true); default: return(false); } default: throw new Exception("Control type no valido"); } }
void OnValidate() { if (agent == null) { agent = GetComponent <NavMeshAgent>(); } if (animatorCtrl == null) { animatorCtrl = GetComponentInChildren <PlayerAnimatorController>(); } if (jumper == null) { jumper = GetComponent <Jumper>(); } }
private void Awake() { walker = body.GetComponent <Walker>(); jumper = body.GetComponent <Jumper>(); spinner = body.GetComponent <Spinner>(); feet = body.GetComponent <Feet>(); stick = body.GetComponent <StickToSurface>(); GameObject playerGO = GameObject.FindWithTag(followTag); if (playerGO != null) { player = playerGO.GetComponentInChildren <Pilot>(true); } }
/// <summary> /// Sets up the required components for this behaviour /// </summary> private void SetUpComponents() { //Jumper jumper = gameObject.AddComponent(typeof(Jumper)) as Jumper; Debug.Log("Jumper Height: " + jumpHeight); jumper.SetJumpHeight(jumpHeight); jumper.SetAsForwardJumperComponent(out groundPoint); //Bullet bullet = gameObject.AddComponent(typeof(Bullet)) as Bullet; bullet.SetBulletSpeed(movementSpeed); bullet.SetAsGravityBullet(); bullet.SetAsForwardJumperComponent(); GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeRotation; }
public virtual void Awake() { if (Active) { return; } Active = true; WallJoint = GetComponent <HingeJoint2D>(); _jumper = GetComponent <Jumper>(); _rigidbody = _rigidbody ?? GetComponent <Rigidbody2D>(); _collider = _collider ?? GetComponent <Collider2D>(); ContactPoint = new GameObject("ContactPoint").transform; ContactPoint.position = Transform.position; ContactPoint.SetParent(Transform); _previousContactPoint = ContactPoint.position; }
protected override void OnAwake() { if(pc == null){ Debug.LogError("No" + pc.getName() + "attached to this object"); } if(aimer == null){ Debug.LogError("No Aimer attached to this object"); } localMover = GetComponent<Mover>(); localJumper = GetComponent<Jumper>(); //onewaybypass = transform.FindChild("OneWayPlatformCollider").GetComponent<OneWayBypass>(); animator = GetComponent<Animator>(); itemController = GetComponentInChildren<ItemController>(); interactFinder = GetComponentInChildren<InteractableFinder>(); inventory = GetComponent<PlayerInventory>(); alignment = AlignmentType.FRIENDLY; }
private void CheckOrbit() { if (Mathf.Abs(_pivot.Rotation - _orbitStart) > 2 * Mathf.Pi) { _curCycle--; _sprite.Modulate = _gradient.Interpolate((float)_curCycle / _maxCycle); _label.Text = $"{_curCycle}"; if (_curCycle <= 0) { _jumper.Die(); _jumper = null; Implode(); } _orbitStart = _pivot.Rotation; } }
public void Setup(Jumper jumper, Trampoline trampoline) { this.jumper = jumper; this.trampoline = trampoline; if (!initialized) { this.JumpPower = trampoline.SpringForceRate; this.BoostPower = jumper.BoostRate; this.BoostTime = jumper.BoostTimeMax; initialized = true; RefreshLabels(); } else { ApplyParam(); } }
public override void Action(Entity e) { if (!e.IsGrounded()) { Jumper j = e.GetComponent <Jumper>(); if (j != null) { e.SetIntVelocityX(j.GetTargetAirSpeed()); if (!falling && e.FallSpeed() >= j.maxAirSpeed / .75) { falling = true; AddNext(typeof(Jumper.JumpLand), ent => ent.IsGrounded() && ent.FallSpeed() >= 0 && ent.JustLanded()); } } } }
protected override void OnAwake() { if (pc == null) { Debug.LogError("No" + pc.getName() + "attached to this object"); } if (aimer == null) { Debug.LogError("No Aimer attached to this object"); } localMover = GetComponent <Mover>(); localJumper = GetComponent <Jumper>(); //onewaybypass = transform.FindChild("OneWayPlatformCollider").GetComponent<OneWayBypass>(); animator = GetComponent <Animator>(); itemController = GetComponentInChildren <ItemController>(); interactFinder = GetComponentInChildren <InteractableFinder>(); inventory = GetComponent <PlayerInventory>(); alignment = AlignmentType.FRIENDLY; }
/// <summary> /// Добавить джампер /// </summary> public void AddJumper() { var startTime = Jumpers.Count == 0 ? new TimeSpan() : Jumpers.Last().EndTime + new TimeSpan(1000); var jumper = new Jumper { JumperMode = JumperModes.First(), Number = Jumpers.Count + 1, StartTime = startTime, EndTime = startTime + new TimeSpan(1000), Film = EEVM.ESVM.SelectedFilm, Season = EEVM.ESVM.SelectedSeason, Episode = EEVM.CurrentEpisode, AddressInfo = EEVM.SelectedAddressInfo }; InsertEntityToDb(jumper); Jumpers = new BindableCollection <Jumper>(CurrentAddressInfo.Jumpers); SelectedJumper = Jumpers.LastOrDefault(); }
void Start() { instance = this; losing = false; counter = score; string playerHighestScore = PlayerPrefs.GetString(PLAYER_HIGHEST_SCORE_KEY); if (playerHighestScore == "") { playerHighestScore = "0"; PlayerPrefs.SetString(PLAYER_HIGHEST_SCORE_KEY, playerHighestScore); highestScore = 0; } else { highestScore = long.Parse(playerHighestScore); } rigid2d = GetComponent<Rigidbody2D>(); }
/// <summary> /// Dodanie nowego skoczka do bazy danych /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonJumperAdd_Click(object sender, EventArgs e) { var jumperFirstName = textBoxJumperFirstName.Text; var jumperLastName = textBoxJumperLastName.Text; var jumperBirthdate = dateTimePickerJumper.Text; var countryId = textBoxJumperCountryId.Text; Jumper newJumper = new Jumper { FirstName = jumperFirstName, LastName = jumperLastName, Birthdate = Convert.ToDateTime(jumperBirthdate), CountryId = Int32.Parse(countryId) }; _jumpers.Create(newJumper); _jumpers.Save(); LoadJumpers(); }
private bool HeroSpawned() { //Waiting for hero to spawn if (_hero == null) { _hero = Hero.Instance; if (_hero == null) { return(false); } _stickiness = _hero.Stickiness; _jumper = _hero.Jumper; _dynamicInteraction = _hero.DynamicInteraction; } return(true); }
/// <summary> /// Zapis zmian danych skoczka /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonJumperSaveChanges_Click(object sender, EventArgs e) { int jumperUpdatedId = Int32.Parse(textBoxUpdateJumperId.Text); var jumperUpdatedFirstName = textBoxUpdateJumperFirstName.Text; var jumperUpdatedLastName = textBoxUpdateJumperLastName.Text; var jumperUpdatedBirthdate = dateTimePickerUpdateJumper.Text; var jumperUpdatedCountryId = textBoxUpdateCountryId.Text; Jumper editJumper = _jumpers.GetById(jumperUpdatedId); editJumper.FirstName = jumperUpdatedFirstName; editJumper.LastName = jumperUpdatedLastName; editJumper.Birthdate = Convert.ToDateTime(jumperUpdatedBirthdate); editJumper.CountryId = Int32.Parse(jumperUpdatedCountryId); _jumpers.Update(editJumper); _jumpers.Save(); LoadJumpers(); }
public override IEnumerator Traverse(Tile tile) { Tile fromTile = unit.tile; unit.Place(tile); // take off float flyHeightY = tile.HexHeight * tile.height + FLY_HEIGHT; //飛行高度 float duration = (flyHeightY - Jumper.position.y) / SPEED; // Tweener tweener = Jumper.MoveToLocal(new Vector3(0, flyHeightY, 0), duration, EasingEquations.EaseInOutQuad); while (tweener != null) { yield return(null); } //turn Directions dir = fromTile.ChangeDirection(tile); yield return(StartCoroutine(Turn(dir))); //move float dist = Mathf.Sqrt(Mathf.Pow(tile.pos.x - fromTile.pos.x, 2) + Mathf.Pow(tile.pos.y - fromTile.pos.y, 2)); //畢氏定理求直線 duration = dist / SPEED; tweener = transform.MoveTo(tile.GridTileCenter, duration, EasingEquations.EaseInOutQuad); while (tweener != null) { yield return(null); } //landing duration = (flyHeightY - tile.GridTileCenter.y) / SPEED; tweener = Jumper.MoveToLocal(Vector3.zero, duration, EasingEquations.EaseInOutQuad); while (tweener != null) { yield return(null); } }
public void PrepareRound() { OnPause(); playerOneHealth.Value = playerOneMaxHealth.Value; playerTwoHealth.Value = playerTwoMaxHealth.Value; playerOneFacing.Value = playerOneFacing.initValue; playerTwoFacing.Value = playerTwoFacing.initValue; playerOneState.SetInvulnerable(false); playerTwoState.SetInvulnerable(false); playerColorManager.InitializePlayer(0); playerColorManager.InitializePlayer(1); playerOneInstance = Instantiate(playerOnePrefab, playerOneStartPos.position, Quaternion.identity, transform.parent); playerTwoInstance = Instantiate(playerTwoPrefab, playerTwoStartPos.position, Quaternion.identity, transform.parent); for (int i = 0; i < ballPrefabs.Count; i++) { GameObject ballPrefab = ballPrefabs[i]; Vector3 startPos = ballStartPositions[i].position; GameObject ballInstance = Instantiate(ballPrefab, startPos, Quaternion.identity, transform.parent); ballInstances.Add(ballInstance); GameObject jumperInstance = Instantiate(jumperPrefabs[i], ballInstance.transform); Jumper jumper = jumperInstance.GetComponent <Jumper>(); //jumper.followColor = ballInstance.GetComponent<BallController>().color; //jumper.colorState = playerColorManager; jumper.players.Add(playerOneInstance.transform); jumper.players.Add(playerTwoInstance.transform); jumper.ball = ballInstance.transform; jumperInstances.Add(jumperInstance); } prepareRoundEvent.Raise(); }
public void EnterWar(ServerInfo Server, MapInfo Map) { ConsoleEx.DebugLog(war.Side.ToString() + " Sub Received : Enter War.", ConsoleEx.YELLOW); GamePlayFSM fsm = Core.GameFSM; if (fsm.CurScene != SceneName.BattleScene) { if (hasEntered == false) { hasEntered = true; monitor.EnterWar(Server.ServerID); cached.map = Map; AsyncTask.QueueOnMainThread( () => { //UnityUtils.JumpToScene(Core.GameFSM, SceneName.BattleScene); Jumper.EnterWarDataInitFinished(); } ); } } }
public void CheckOrbits() { if (Math.Abs(_pivot.Rotation - _orbitStart) > 2 * Math.PI) { _currentOrbits -= 1; if (GameSettings.Instance().EnableSound) { _beepPlayer.Play(); } _label.Text = _currentOrbits.ToString(); if (_currentOrbits <= 0) { _jumper.Die(); _jumper = null; Implode(); } _orbitStart = _pivot.Rotation; } }
public void AddVolumeJumper() { if (CanAddVolumeJumper is false) { return; } var jumper = new Jumper { JumperMode = JumperMode.LowerVolume, Number = Jumpers.Count + 1, StartTime = new TimeSpan(), StandardVolumeValue = MediaPlayer.Volume, Film = EEVM.ESVM.SelectedFilm, Season = EEVM.ESVM.SelectedSeason, Episode = EEVM.CurrentEpisode, AddressInfo = EEVM.SelectedAddressInfo }; InsertEntityToDb(jumper); Jumpers = new BindableCollection <Jumper>(CurrentAddressInfo.Jumpers); RefreshJumpersConfig(); NotifyOfPropertyChange(() => CanAddVolumeJumper); }
void OnValidate() { if (animatorCtrl == null) { animatorCtrl = GetComponentInChildren <PlayerAnimatorController>(); } if (runner == null) { runner = GetComponent <Runner>(); } if (kicker == null) { kicker = GetComponent <Kicker>(); } if (jumper == null) { jumper = GetComponent <Jumper>(); } if (climber == null) { climber = GetComponent <Climber>(); } }
public void NewGame() { _score = 0; _level = 1; _hud.UpdateScore(_score); var camera = GetNode <Camera2D>("Camera2D"); var startPosition = GetNode <Position2D>("StartPosition"); _player = (Jumper)_jumperScene.Instance(); _player.Position = startPosition.Position; AddChild(_player); _player.Connect("Captured", this, nameof(OnJumperCaptured)); _player.Connect("Died", this, nameof(OnJumperDied)); SpawnCircle(startPosition.Position); _hud.Show(); _hud.ShowMessage("GO!!"); if (GameSettings.Instance().EnableMusic) { _musicPlayer.Play(); } }
/// <summary> /// Импорт настроек опции /// </summary> public void ImportOptionData() { if (CanImportOptionData is false) { return; } using (var ctx = new CVDbContext(AppDataPath)) { var option = ctx.EpisodeOptions .Include(eo => eo.Jumpers) .First(eo => eo.EpisodeOptionId == SelectedEpisodeOption.EpisodeOptionId); if (option == null) { throw new Exception("Опция не существует"); } foreach (var jumper in option.Jumpers.ToList()) { ctx.Jumpers.Remove(jumper); ctx.SaveChanges(); } Jumpers.Clear(); SelectedEpisodeOption.Jumpers.Clear(); var count = 1; foreach (var j in ImportingEpisodeOption.Jumpers) { var jumper = new Jumper { EpisodeOptionId = SelectedEpisodeOption.EpisodeOptionId, StartTime = j.StartTime, SkipCount = j.SkipCount, Number = count++ }; option.Jumpers.Add(jumper); ctx.SaveChanges(); jumper = ctx.Jumpers.ToList().Last(); Jumpers.Add(jumper); SelectedEpisodeOption.Jumpers.Add(jumper); } option.CreditsStart = ImportingEpisodeOption.CreditsStart; SelectedEpisodeOption.CreditsStart = ImportingEpisodeOption.CreditsStart; option.Duration = CalculatingDuration(option); SelectedEpisodeOption.Duration = CalculatingDuration(option); SelectedJumper = Jumpers.First(); EditableEpisodeTime = ConvertToEpisodeTime(SelectedEpisodeOption, SelectedJumper); ctx.SaveChanges(); TempEpisodeOptionSnapshot = JsonConvert.SerializeObject(SelectedEpisodeOption); NotifyOfPropertyChange(() => SelectedEpisodeOption); NotifyOfPropertyChange(() => Jumpers); NotifyOfPropertyChange(() => CanImportOptionData); NotifyEditingButtons(); NotifyTimeProperties(); } }
void Start() { score = GameObject.Find("ScoreLoader").GetComponent <ScoreLoader>(); jumper = GameObject.Find("Jumper").GetComponent <Jumper>(); sound = GameObject.Find("Points Audio Source").GetComponent <AudioSource>(); }
/// <summary> /// FileVersion.Current - Need 46 bytes /// </summary> /// <param name="bytes"></param> /// <param name="offset"></param> /// <param name="version"></param> public InputPoint(byte[] bytes, int offset = 0, FileVersion version = FileVersion.Current) : base(bytes, offset, version) { offset += InoutPoint.GetSize(FileVersion); int valueRaw; Unit unit; byte filterRaw; byte calibrationHRaw; byte calibrationLRaw; byte decomRaw; switch (FileVersion) { case FileVersion.Current: valueRaw = bytes.ToInt32(ref offset); filterRaw = bytes.ToByte(ref offset); decomRaw = bytes.ToByte(ref offset); SubId = bytes.ToBoolean(ref offset); SubProduct = bytes.ToBoolean(ref offset); Control = (OffOn)bytes.ToByte(ref offset); AutoManual = (AutoManual)bytes.ToByte(ref offset); DigitalAnalog = (DigitalAnalog)bytes.ToByte(ref offset); CalibrationSign = (Sign)bytes.ToByte(ref offset); SubNumber = SubNumberFromByte(bytes.ToByte(ref offset)); calibrationHRaw = bytes.ToByte(ref offset); calibrationLRaw = bytes.ToByte(ref offset); unit = UnitFromByte(bytes.ToByte(ref offset), DigitalAnalog); break; default: throw new FileVersionNotImplementedException(FileVersion); } Value = new VariableValue(valueRaw, unit); Filter = (int)Math.Pow(2, filterRaw); CalibrationH = calibrationHRaw / 10.0; CalibrationL = calibrationLRaw / 10.0; //Status var statusIndex = decomRaw % 16; if (statusIndex >= (int)InputStatus.Normal && statusIndex <= (int)InputStatus.Shorted) { Status = (InputStatus)statusIndex; } else { Status = InputStatus.Normal; } //Jumper var jumperIndex = decomRaw / 16; if (jumperIndex >= (int)Jumper.Thermistor && jumperIndex <= (int)Jumper.To10V) { Jumper = (Jumper)jumperIndex; } else { Jumper = jumperIndex == 4 ? (Jumper)4 //TODO: NOT MINE: Fix for T3DemoRev6.prg : Jumper.Thermistor; } CheckOffset(offset, GetSize(FileVersion)); }
public DudeOutput(Jumper jumper) { this.jumper = jumper; }
// Initialize thej umper variable. void Start () { GameObject p = GameObject.FindGameObjectWithTag("Player"); jumper = p.GetComponent<Jumper>(); }
private void UpdateItem(Item item, SocketIOEvent e, bool smooth) { Vector3 position = Vector3.zero; e.data.GetField(ref position.x, "x"); e.data.GetField(ref position.z, "y"); Color color = new Color(); e.data.GetField(ref color.r, "r"); e.data.GetField(ref color.g, "g"); e.data.GetField(ref color.b, "b"); if (item.transform.GetComponent <ColoringHelper>().objectToBeRotated) { Vector3 newDirection = new Vector3(); e.data.GetField(ref newDirection.x, "directionX"); e.data.GetField(ref newDirection.z, "directionY"); GameObject objectToBeRotated = item.transform.GetComponent <ColoringHelper>().objectToBeRotated; if (newDirection.z > 0) { // UP objectToBeRotated.transform.localRotation = Quaternion.Euler(0, 90, 0); } else if (newDirection.z < 0) { // DOWN objectToBeRotated.transform.localRotation = Quaternion.Euler(0, -90, 0); } else if (newDirection.x < 0) { // LEFT objectToBeRotated.transform.localRotation = Quaternion.Euler(0, 0, 0); } else if (newDirection.x > 0) { // RIGHT objectToBeRotated.transform.localRotation = Quaternion.Euler(0, -180, 0); } } Jumper jumper = item.transform.gameObject.GetComponent <Jumper>(); if (item.type == "block") { bool isCarried = false; e.data.GetField(ref isCarried, "isCarried"); if (!isCarried) { jumper.addPosition = Vector3.zero; } } if (jumper != null && smooth) { jumper.MoveTo(position); } else { item.transform.position = position; } item.transform.gameObject.GetComponent <ColoringHelper>().modelRenderer.material.color = color; item.transform.gameObject.GetComponentInChildren <MinimapItem>().SetColor(color); if (item.type == "user") { string carries = null; e.data.GetField(ref carries, "carries"); Player player = item.transform.gameObject.GetComponent <Player> (); if (carries != null) { Item carriesItem = this._items.Find(i => i.id == carries); Jumper j = carriesItem.transform.GetComponent <Jumper>(); j.addPosition = Vector3.up; bool isFirstTime = player._isCarrying == null; if (isFirstTime) { j.MoveTo(position); } else { j.MoveTo(position, jumper.defaultJumpHeight); } if (player) { player.SetCarrying(carriesItem.transform.GetComponent <Block> ()); } } else { if (player) { player.SetCarrying(null); } } } }
public void SetJumper(Jumper jumper) { _jumper = jumper; }
void Start() { jumper = GetComponent <Jumper>(); }
public FPSCounter(Jumper game) : base(game) { }
// Initialize the playerRb and jumper variables. void Start () { GameObject p = GameObject.FindGameObjectWithTag("Player"); playerRb = p.GetComponent<Rigidbody2D>(); jumper = p.GetComponent<Jumper>(); }