Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class MyMainObject : MonoBehaviour
- {
- public Vector2 position;
- public Vector2 texture;
- public Vector2 CollisionBoxLeftTop, CollisionBoxRightBottom;
- public Transform thisTransform;
- public int timeDisplayed;
- public OTAnimatingSprite mySprite;
- void Start()
- {
- mySprite = GetComponent<OTAnimatingSprite>();
- thisTransform = transform;
- }
- public virtual Vector2 GetSize()
- {
- if (mySprite.texture != null)
- return new Vector2(mySprite.texture.width, mySprite.texture.height);
- else
- return Vector2.zero;
- }
- public virtual float GetDrawBaseHeight()
- {
- return thisTransform.position.y + GetSize().y;
- }
- public Vector2 GetCenter() //POSITION OF TEXTURE CENTER
- {
- return new Vector2(thisTransform.position.x + mySprite.texture.width / 2, thisTransform.position.y + mySprite.texture.height / 2);
- }
- public Vector2 GetCollisionBoxCenter()
- {
- return ( CollisionBoxLeftTop + CollisionBoxRightBottom ) / 2;
- }
- public virtual void Update(float time)
- {
- timeDisplayed++;
- }
- }
Add Comment
Please, Sign In to add comment