Exemplo n.º 1
0
        private void Follow(float?delta = null)
        {
            float   deltaTime = delta ?? ((Time.deltaTime + Time.smoothDeltaTime) * 0.5f);
            Vector3 current   = this.Position;
            Vector3 target    = this.Target.GetPosition() + this.Offset;
            float   amount    = FlaiMath.Clamp(deltaTime * this.Power, 0, 1);

            if (this.X)
            {
                current.x = FlaiMath.Lerp(this.LerpType, current.x, target.x, amount);
            }

            if (this.Y)
            {
                current.y = FlaiMath.Lerp(this.LerpType, current.y, target.y, amount);
            }

            if (this.Z)
            {
                current.z = FlaiMath.Lerp(this.LerpType, current.z, target.z, amount);
            }

            this.Position = current;
        }
 public void MoveLeft()
 {
     _moveDirection = FlaiMath.Clamp(_moveDirection - 1, -1, 1);
 }
 public void MoveRight()
 {
     _moveDirection = FlaiMath.Clamp(_moveDirection + 1, -1, 1);
 }
Exemplo n.º 4
0
 public static Color32 MultiplyAlpha(this Color32 color, float alpha)
 {
     return(new Color32(color.r, color.g, color.b, (byte)FlaiMath.Clamp(color.a * alpha, 0, 255)));
 }