Ejemplo n.º 1
0
 private void UpdateWeightModification()
 {
     if (Player_ != null)
     {
         Player_.SetWeightModification(this, chargedTime_ > 0.0f ? kPlayerAddedWeight : 0.0f);
     }
 }
Ejemplo n.º 2
0
 public void SetPlayerUI()
 {
     if (IsPlayer())
     {
         Player_ player = (Player_)owner;
         playerUi = player.GetComponentInChildren <PlayerUi_>();
     }
 }
Ejemplo n.º 3
0
        public World(Seed seed, string name)
        {
            PlaySetting      = PlaySetting_.ToReadOnlyReactiveProperty();
            Player           = Player_.ToReadOnlyReactiveProperty();
            CurrentDimension = CurrentDimension_.ToReadOnlyReactiveProperty();

            Id.Value   = GetHashCode().ToString();
            Name.Value = name;
            Seed.Value = seed;
        }
Ejemplo n.º 4
0
 private void AnimateShieldHit(bool hideShieldAfterwards = false)
 {
     CoroutineWrapper.DoEaseFor(kShieldAnimateDuration, EaseType.QuadraticEaseOut, (float percentage) => {
         float inversePercentage = 1.0f - percentage;
         float alpha             = Mathf.Lerp(GameConstants.Instance.PlayerShieldAlphaMin, kShieldAlphaMax, inversePercentage);
         Player_.SetShieldAlpha(alpha);
     }, () => {
         if (hideShieldAfterwards)
         {
             Player_.SetShieldAlpha(0.0f);
         }
     });
 }
Ejemplo n.º 5
0
        private void Dash(Vector3 direction)
        {
            dashCollider_.enabled = true;
            this.DoAfterDelay(kDashDuration, () => {
                dashCollider_.enabled = false;
            });

            Vector3 endPosition = Player_.Rigidbody.position + (kDashDistance * Player_.WeightedRatio() * direction);

            Controller_.MoveTo(Player_, endPosition, kDashDuration, EaseType.CubicEaseOut);
            AudioConstants.Instance.Dash.PlaySFX();
            OnDash.Invoke();
            OnPlayerDash.Invoke(Player_);
        }
Ejemplo n.º 6
0
 public override void Build(Owner_ owner)
 {
     base.Build(owner);
     bottomUi = FindObjectOfType <BottomUi>();
     player   = FindObjectOfType <Player_>();
 }
 private void Awake()
 {
     bottomUi = FindObjectOfType <BottomUi>();
     player   = FindObjectOfType <Player_>();
 }
        private void FixedUpdate()
        {
            if (!Enabled)
            {
                return;
            }

            Vector2 speedVector      = InputDelegate_.MovementVector * kPlayerSpeed * Player_.WeightedRatio();
            Vector3 speedWorldVector = speedVector.Vector3XZValue();

            if (InGameConstants.AllowBattlePlayerMovement)
            {
                Player_.Rigidbody.velocity = speedWorldVector;
            }
            else
            {
                Player_.Rigidbody.velocity = Vector3.zero;
            }
            Player_.Rigidbody.angularVelocity = Vector3.zero;

            // snap rotation if input is not (0, 0)
            if (speedWorldVector.magnitude > Mathf.Epsilon)
            {
                Vector3 speedWorldDirection = speedWorldVector.normalized;
                if (speedWorldDirection == Vector3.zero)
                {
                    return;
                }

                Player_.Rigidbody.MoveRotation(Quaternion.LookRotation(speedWorldDirection));
            }
        }