Advertisement
infinite_ammo

SquishScale.cs

Feb 11th, 2013
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class SquishScale : MonoBehaviour
  5. {
  6.     public float amount = .1f;
  7.     public float speed = 10f;
  8.     public float timeOffset;
  9.     private Vector3 originalScale;
  10.    
  11.     void Awake()
  12.     {
  13.         originalScale = transform.localScale;
  14.     }
  15.    
  16.     void Update()
  17.     {
  18.         transform.localScale = new Vector3(
  19.                 originalScale.x + Mathf.Sin(Time.time * speed + timeOffset) * amount,
  20.                 originalScale.y + Mathf.Sin(Time.time * speed + timeOffset + Mathf.PI) * amount,
  21.             1f);   
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement