gutterball-3/Gutterball 3/Assets/Scripts/AnimatedPlanet.cs
SkunkStudios 0b195a0fc1 Custom Balls and Cosmic Alleys
Strike it big with amazing bowling action! Everything that made Gutterball 3D a hit is here - incredible 3D graphics, cool ball-rolling controls, hilarious characters - and more! Eight all-new alleys are waxed and ready for you to toss your choice of 85 unique bowling balls. As you play, earn points and cash and unlock alleys and balls. Even customize a ball with your own settings and images! Addictive bowling fun that will bowl you over!
2025-01-16 16:07:45 +07:00

26 lines
1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AnimatedPlanet : MonoBehaviour
{
public float SpeedX, SpeedY;
private float CurrX, CurrY;
// Use this for initialization
void Start ()
{
CurrX = GetComponent<Renderer>().material.mainTextureOffset.x;
CurrY = GetComponent<Renderer>().material.mainTextureOffset.y;
GetComponent<Renderer>().material.SetTextureOffset("_MainTex", new Vector2(Random.Range(-CurrX * 360, CurrX * 360), Random.Range(-CurrY * 360, CurrY * 360)));
GetComponent<Renderer>().material.SetTextureOffset("_BumpMap", new Vector2(Random.Range(-CurrX * 360, CurrX * 360), Random.Range(-CurrY * 360, CurrY * 360)));
}
// Update is called once per frame
void Update ()
{
CurrX += Time.deltaTime * SpeedX;
CurrY += Time.deltaTime * SpeedY;
GetComponent<Renderer>().material.SetTextureOffset("_MainTex", new Vector2(CurrX, CurrY));
GetComponent<Renderer>().material.SetTextureOffset("_BumpMap", new Vector2(CurrX, CurrY));
}
}