コード例 #1
0
        private void FixedUpdate()
        {
            Rigidbody2D rb = GetComponent <Rigidbody2D>();

            float driftFactor = _driftSticky;

            if (RightVelocity.magnitude > _maxVelocity)
            {
                driftFactor = _driftSlippy;
            }

            rb.velocity = ForwardVelocity + RightVelocity * driftFactor;

            if (_accelerate)
            {
                rb.AddForce(transform.up * _speed);
            }

            if (_brake)
            {
                rb.AddForce(transform.up * -_speed);
            }

            float tf = Mathf.Lerp(0, _torque, rb.velocity.magnitude / 2);

            rb.angularVelocity = _angular * tf;

            OutOfScreen.CheckOutOfScreen(transform);
        }
コード例 #2
0
 public override void _Process(float delta)
 {
     if (Position.x + Camera.ScreenSize.x < Camera.Position.x)
     {
         OutOfScreen?.Invoke(this);
         QueueFree();
     }
 }
コード例 #3
0
ファイル: Missile.cs プロジェクト: JuicyPark/CommandPractice
 void CheckOutOfScreen()
 {
     if (transform.position.y < bottomY)
     {
         isActivated = false;
         OutOfScreen?.Invoke(this);
     }
 }
コード例 #4
0
    public LevelOfDetail(Animal animal)
    {
        _gO          = animal.gameObject;
        _type        = H.Animal;
        _geometry    = animal.Geometry;
        _outOfScreen = new OutOfScreen(animal);

        SetLOD();
    }
コード例 #5
0
    public LevelOfDetail(Person person)
    {
        _gO          = person.gameObject;
        _type        = H.Person;
        _geometry    = person.Geometry;
        _outOfScreen = new OutOfScreen(person);

        SetLOD();
    }
コード例 #6
0
 private void Start()
 {
     outOfScreen = GetComponent <OutOfScreen>();
 }