public override void OnSpawn(SpawnPoint spawnpoint) { base.OnSpawn(spawnpoint); WaspSpawnPoint waspSpawnPoint = spawnpoint.GetComponent <WaspSpawnPoint>(); _armorToAttack = waspSpawnPoint.ArmorToAttack; _splineYOffset = PartyParrotManager.Instance.Random.NextSingle(-waspSpawnPoint.Offset, waspSpawnPoint.Offset); // init our spline state _spline = waspSpawnPoint.GetComponent <BezierSpline>(); _splineLength = _spline.EstimatedLength(); _splinePosition = 0.0f; // teleport to our starting position // setting the behavior's Position doesn't seem to immediately warp // so falling back on just forcing the transform position to move :( Vector3 targetPosition = _spline.GetPoint(0.0f); targetPosition.y += _splineYOffset; Movement2D.Teleport(targetPosition); if (null != AnimationHelper) { AnimationHelper.SetFacing(Vector3.zero - transform.position); } SetState(WaspState.FollowingSpline); }
public override void OnDeSpawn() { _attackCooldownTimer.Stop(); _attackEndEffect.StopTrigger(); _attackStartEffect.StopTrigger(); _spline = null; _armorToAttack = null; base.OnDeSpawn(); }