/*var frames : Texture2D[]; * * var framesPerSecond = 10.0; * * function Update () { * var index : int = Time.time * framesPerSecond; * index = index % frames.Length; * renderer.material.mainTexture = frames[index]; * }*/ // Use this for initialization void Awake() { tCommon = GetComponent <TwoCommon> (); anim = GetComponent <Animator> (); //gameObject.GetComponent<SpriteRenderer> ().sprite = test; //imageTextAsset = Resources.Load("tex_petDinoTEST.png") as TextAsset; //Texture2D tex = new Texture2D(64, 32); //tex.LoadImage(imageTextAsset.bytes); //renderer.material.mainTexture = (Texture2D)Resources.Load("tex_petDinoTEST.png"); //anim.get //test2.name = test.name; //this.GetComponent<SpriteRenderer>().material.SetTexture("_MainTex", test); /*string skin; * SpriteRenderer[] renderers = GetComponentsInChildren<SpriteRenderer>(); * * print ("LOOK: " + renderers.Length); * * for (int i = 0; i < renderers.Length; i++) { * * MaterialPropertyBlock block = new MaterialPropertyBlock(); * block.AddTexture("_MainTex", test); * renderers[i].SetPropertyBlock(block); * }*/ }
// Use this for initialization void Awake() { tColLine = GetComponent <TwoColLine> (); tCommon = GetComponent <TwoCommon> (); tColPhys = GetComponent <TwoColPhysics> (); pGrav = GetComponent <PlatGravity> (); }
void Awake() { GameObject temp = (GameObject)HierarchicalPrefabUtility.Instantiate(preShadow); sRenderer = temp.GetComponent <SpriteRenderer> (); tCommon = GetComponent <TwoCommon> (); tFlip = GetComponent <TwoFlip> (); tFlipOther = preShadow.GetComponent <TwoFlip> (); }
void Awake() { pCommonBasic = GetComponent <TwoCommonBasic> (); pCommon = GetComponent <TwoCommon> (); tCols = GetComponents <TwoCol>(); if (flipXManual) { flip = -1; UpdateScale(); } }
// Use this for initialization void Awake() { pCommon = GetComponent <TwoCommon> (); tCol = GetComponent <TwoColSquare> (); tColPhys = GetComponent <TwoColPhysics> (); pGravity = GetComponent <PlatGravity> (); pRamp = GetComponent <PlatPhysRamp> (); pGlobal = StatMini.GetMiniContainer(transform).GetComponent <TwoGlobal> (); input = StatMini.GetMiniContainer(transform).GetComponent <MiniInput> (); }
// Use this for initialization void Awake() { TwoCol[] temp = GetComponents <TwoCol> (); foreach (TwoCol e in temp) { if (e.HasType(TwoCol.ColType.PHYSICS_OFF)) { tCol = e; break; } } tCommon = GetComponent <TwoCommon> (); }
// Use this for initialization public virtual void Awake() { myTransform = this.transform; // Ryan says not to put "find" in awake. He may have a point. Fine fine Ill put it in start. fukin noob mate. colManager = GameObject.Find("CollisionManager").GetComponent <TwoColManager> (); tCommon = GetComponent <TwoCommon> (); foreach (ColType e in types) { if (e == ColType.PHYSICS_DEF || e == ColType.COMBAT_DEF || e == ColType.T1_DEF || e == ColType.T2_DEF || e == ColType.T3_DEF) { colManager.AddCol(this); return; } } }
// This is specific to squares. public Vector2 CheckColPhys(TwoColSquarePlat other, ref TwoCommon tCommon) { Vector2 output = Vector2.zero; foreach (TwoCol e in twoCol) { if (e == other || !e.CanCollide(other)) { continue; } Vector2 vec = Vector2.zero; if (e.GetType() == typeof(TwoColSquarePlat)) { vec = other.CheckColSquarePhys((TwoColSquarePlat)e, ref tCommon); } else if (e.GetType() == typeof(TwoColLine)) { if (tCommon.YSpeed <= 0.0f) { vec = other.CheckCol(e); tCommon.Pos += vec; } } else { vec = other.CheckCol(e); tCommon.Pos += vec; } if (vec != Vector2.zero) { output += vec; } } // No collisions. return(output); }
void Awake() { pCommon = GetComponent <TwoCommon> (); tColLine = GetComponent <TwoColLine> (); }
void Awake() { pCommon = GetComponent <TwoCommon> (); tColPhys = GetComponent <TwoColPhysics> (); }
void Awake() { pCommon = GetComponent <TwoCommon> (); pCommon.Vel = startMove; }
// Use this for initialization void Awake() { tCommon = GetComponent <TwoCommon> (); }
void Awake() { pCommon = GetComponent <TwoCommon> (); tCols = GetComponents <TwoCol> (); }
void Awake() { tColSquare = GetComponent <TwoColSquarePlat> (); tCommon = GetComponent <TwoCommon> (); }
public Vector2 CheckColSquarePhys(TwoColSquarePlat other, ref TwoCommon tCommon) { if (!CheckColBounds(other)) { return(Vector2.zero); } float safe = 1.5f; // Check for X collision. if (other.Sides == ColSides.ALL || other.Sides == ColSides.LEFT || other.Sides == ColSides.RIGHT) { if ( (BL.x + tCommon.Vel.x < other.TR.x) && (TR.x + tCommon.Vel.x > other.BL.x) && (BL.y - tCommon.Vel.y + safe < other.TR.y) && (TR.y - tCommon.Vel.y - safe > other.BL.y) ) { if (Center.x < other.Center.x && (other.Sides == ColSides.ALL || other.Sides == ColSides.LEFT) ) { tCommon.X = other.BL.x - localTR.x; return(-Vector2.right); } else if (other.Sides == ColSides.ALL || other.Sides == ColSides.RIGHT) { tCommon.X = other.TR.x - localBL.x; return(Vector2.right); } } } if (other.Sides == ColSides.ALL || other.Sides == ColSides.UP || other.Sides == ColSides.DOWN) { // Check for Y collision. if ( (BL.x - tCommon.Vel.x + safe < other.TR.x) && (TR.x - tCommon.Vel.x - safe > other.BL.x) && (BL.y + tCommon.Vel.y < other.TR.y) && (TR.y + tCommon.Vel.y > other.BL.y) ) { if (Center.y < other.Center.y && (other.Sides == ColSides.ALL || other.Sides == ColSides.DOWN) ) { tCommon.Y = other.BL.y - localTR.y; return(-Vector2.up); } /* LEAVE IT! It works for the one way platforms! */ else if (BL.y > other.TR.y - safe + tCommon.YSpeed && tCommon.YSpeed < 0.0f && (other.Sides == ColSides.ALL || other.Sides == ColSides.UP) ) { tCommon.Y = other.TR.y + localBL.y; return(Vector2.up); } } } return(Vector2.zero); }
void Awake() { pCommon = GetComponent <TwoCommon> (); //pCollisions = GetComponent<PlatCollision> (); }