private IEnumerator ShotAlignBullet() { _alignShotDone = true; float timer = 0f; while (!_stateEnd) { timer += JITimer.Instance.DeltTime; if (timer > m_alignBulletEmitInterval) { timer -= m_alignBulletEmitInterval; // The align shot bullet number is set to 1 to ensure that each // shot can only shot one bullet. Align shot bullet emit interval is controlled by m_alignBulletEmitInterval m_alignShotLeft.m_bulletNum = m_alignShotRight.m_bulletNum = 1; m_alignShotLeft.Shot(); m_alignShotRight.Shot(); } yield return(null); } }
void DrawProperties() { UbhBaseShot obj = target as UbhBaseShot; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Start Shot")) { if (Application.isPlaying && obj.gameObject.activeInHierarchy) { obj.Shot(); } } EditorGUILayout.EndHorizontal(); if (obj.m_bulletPrefab == null) { Color guiColor = GUI.color; GUI.color = Color.yellow; EditorGUILayout.LabelField("*****WARNING*****"); EditorGUILayout.LabelField("BulletPrefab has not been set!"); GUI.color = guiColor; } EditorGUILayout.Space(); DrawDefaultInspector(); }
private void Fake_RealBossMove(Vector3 dest) { var moveEffect = new Effect <Transform, Vector3> (); moveEffect.Duration = 2f; moveEffect.RetrieveStart = (falcon, lastValue) => falcon.position; moveEffect.RetrieveEnd = (falcon) => dest; moveEffect.OnUpdate = (falcon, pos) => falcon.position = pos; moveEffect.RunEffectUntilTime = (curTime, stopTime) => curTime < stopTime + _fakeDashTime; moveEffect.OnDone = (falcon) => { _realBossShotPattern.transform.position = falcon.position; _realBossShotPattern.Shot(); }; var pauseEffect = new Effect <Transform, Vector3> (); pauseEffect.Duration = _fakeStateWaitTime; pauseEffect.OnUpdate = (falcon, pos) => Debug.Log(Time.time); var seq = new Sequence <Transform, Vector3> (); seq.Add(moveEffect); seq.Add(pauseEffect); seq.Reference = _falcon; seq.OnComplete = (falcon) => Fake_Transistion(); _realBossMoveSeq = Movement.Run(seq); }
private void Fake_FakeBossMove(Transform fakeBoss, Vector3 dest) { var effect1 = new Effect <Transform, Vector3> (); effect1.Duration = 2f; effect1.RetrieveStart = (fake, lastValue) => fake.position; effect1.RetrieveEnd = (fake) => dest; effect1.OnUpdate = (fake, pos) => fake.position = pos; var effect2 = new Effect <Transform, Vector3> (); effect2.Duration = _fakeDashTime; effect2.RetrieveStart = (fake, lastValue) => lastValue; effect2.RetrieveEnd = (fake) => new Vector3(dest.x, BulletDestroyBound.Instance.Center.y - BulletDestroyBound.Instance.Size.y * 0.65f, dest.z); effect2.OnUpdate = (fake, pos) => fake.position = pos; effect2.CalculatePercentDone = Easing.GetEase(Easing.EaseType.Pow3Out); var seq = new Sequence <Transform, Vector3> (); seq.Add(effect1); seq.Add(effect2); seq.Reference = fakeBoss; seq.OnComplete = (fake) => { _fakeBossShotPattern.transform.position = fake.position; _fakeBossShotPattern.OnShotFinish += (shotPattern) => Destroy(fake.gameObject); _fakeBossShotPattern.Shot(); }; _fakeBossMoveSeq = Movement.Run(seq); }
private void UpdateAttack(EnemyProperty enemyProperty) { // Move done, after m_timeTWaitAfterShot seconds, end the state. if (_moveDone) { if (_attackTimer >= m_timeToWaitAfterShotDone) { _stateEnd = true; CallOnStateEnd(); } } // move not done, shot bullet else if (_attackTimer > m_shotInterval) { _attackTimer -= m_shotInterval; m_shotPattern.Shot(); } }
private void Shot() { _timer += JITimer.Instance.DeltTime; if (_timer >= m_shotInterval) { m_shotPattern.Shot(); _curShotTimes--; _timer -= m_shotInterval; } // Shot Done if (_curShotTimes == 0) { _allShotDone = true; _timer = 0; } }