コード例 #1
0
 private void RemoveItem(IClimber climber)
 {
     if (_climbers.Contains(climber))
     {
         _climbers.Remove(climber);
     }
 }
コード例 #2
0
        private void Move(IClimber climber)
        {
            var tr        = climber.transform;
            var pos       = tr.position;
            var direction = Vector3.down;
            var toPos     = pos + direction * _moveSpeed;
            var step      = _moveSpeed * Time.deltaTime;

            tr.position = Vector3.MoveTowards(pos, toPos, step);
        }
コード例 #3
0
        private void AddItem(IClimber climber, GameObjectCollisionHandler wall)
        {
            if (!_climbers.Contains(climber))
            {
                _climbers.Add(climber);
                climber.OnCanceledCling += CanceledCling;
                climber.OnDestroyed     += () => { _climbers.Remove(climber); };

                var direction = climber.transform.position - wall.transform.position;
                direction.y = 0;
                direction.z = 0;
                direction   = direction.normalized;
                climber.transform.rotation = Quaternion.LookRotation(direction);
            }
        }
コード例 #4
0
 private void CanceledCling(IClimber climber)
 {
     RemoveItem(climber);
     climber.OnCanceledCling -= CanceledCling;
 }