Beispiel #1
0
        protected override void OnUpdate(float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(elapseSeconds, realElapseSeconds);

            CachedTransform.Translate(Vector3.forward * -data.Speed * elapseSeconds, Space.World);
            CachedTransform.Rotate(random * 90 * elapseSeconds, Space.Self);
        }
Beispiel #2
0
        protected internal override void OnUpdate(float elapseSeconds, float realElapseSeconds)
        {
            base.OnUpdate(elapseSeconds, realElapseSeconds);

            CachedTransform.Translate(Vector3.back * m_AsteroidData.Speed * elapseSeconds, Space.World);
            CachedTransform.Rotate(m_RotateSphere * m_AsteroidData.AngularSpeed * elapseSeconds, Space.Self);
        }
        protected override void AddRiverNeighbor(AbstractTile tile)
        {
            base.AddRiverNeighbor(tile);

            if (RiverNeighbors.Count >= 3)             // led to a better effect at the time
            {
                return;
            }

            CachedTransform.LookAt(tile.CachedTransform, CachedTransform.up);

            // Get a random boolean to randomly rotate 180°
            bool shouldRotate = RandomUtil.RandomBool();

            if (shouldRotate)
            {
                CachedTransform.Rotate(CachedTransform.up, 180.0f);
            }
        }
Beispiel #4
0
        protected override void AddRoadNeighbor(AbstractTile tile)
        {
            base.AddRoadNeighbor(tile);

            bool shouldRotate = CachedTransform.DirectionIsFacingTransform(Direction.Forward, tile.CachedTransform) ||
                                CachedTransform.DirectionIsFacingTransform(Direction.Right, tile.CachedTransform);

            CachedTransform.DirectionLookAtTransform(roadDirection, tile.CachedTransform);

            if ((GridPosition.x + GridPosition.y & 1) == 0)
            {
                shouldRotate ^= true;
            }

            if (shouldRotate)
            {
                CachedTransform.Rotate(CachedTransform.up, 180.0f);
            }
        }
Beispiel #5
0
 /// <summary>
 /// 转身
 /// </summary>
 /// <param name="destVec">目标位置</param>
 public void Rotate(Vector3 destVec)
 {
     CachedTransform.Rotate(destVec);
 }
 private void Start()
 {
     CachedTransform.Rotate(CachedTransform.up, rotationValue * Random.Range(0, 4));
 }
 private void Start()
 {
     // Rotate randomly, for all 4 possiblities
     CachedTransform.Rotate(CachedTransform.up, Random.Range(0, 4) * 90);
 }