Ejemplo n.º 1
0
 void OnTriggerStay2D(Collider2D other)
 {
     cscript = other.gameObject.GetComponent<collider_script>();
     if (cscript != null && cscript.gameObject.name == "collider_box")
     {
         pscript = cscript.transform.parent.parent.GetComponent<player_script>();
         if (pscript != null)
             cscript.transform.collider2D.isTrigger = ((pscript.fall_through && pscript.accel.y <= 0) || pscript.accel.y > 0) ? true : false;
     }
 }
Ejemplo n.º 2
0
 void OnTriggerExit2D(Collider2D other)
 {
     pcollider = other.gameObject.GetComponent<collider_script>();
     if (pcollider != null && pcollider.gameObject.name == "collider_box")
         pscript = pcollider.transform.parent.parent.GetComponent<player_superscript>();
     if (pscript != null)
     {
         pcollider.transform.collider2D.isTrigger = false;
         pscript.fall_through = false;
     }
 }
Ejemplo n.º 3
0
 void OnCollisionStay2D(Collision2D coll)
 {
     pcollider = coll.collider.gameObject.GetComponent<collider_script>();
     if (!pcollider.transform.collider2D.isTrigger)
     {
         if (pcollider != null)
             pscript = pcollider.transform.parent.parent.GetComponent<player_superscript>();
         if (pscript != null)
             if (pscript.fall_through)
                 pcollider.transform.collider2D.isTrigger = true;
     }
 }
Ejemplo n.º 4
0
 // Kills the character and then respawns him, for the moment at a fixed position.
 void OnCollisionEnter2D(Collision2D coll)
 {
     cs = coll.collider.gameObject.GetComponent<collider_script>();
     if (cs != null)
         ps = cs.transform.parent.parent.GetComponent<player_superscript>();
     if (ps != null)
     {
         ps.transform.position = new Vector3(-0.14f, 4, 0);
         ps.movement = Vector2.zero;
         ps.speed = Vector2.zero;
         ps.accel = Vector2.zero;
         ps.gravity = new Vector2(0, -0.5f);
         ps.n_jumps = 1;
         ps.state = player_superscript.State.S_FALL;
     }
 }
Ejemplo n.º 5
0
 void OnCollisionEnter2D(Collision2D coll)
 {
     pcollider = coll.collider.gameObject.GetComponent<collider_script>();
     if (!pcollider.transform.collider2D.isTrigger)
     {
         if (pcollider != null)
             pscript = pcollider.transform.parent.parent.GetComponent<player_superscript>();
         if (pscript != null)
         {
             if (pscript.state == player_superscript.State.S_KICK)
             {
                 pscript.transform.rotation = Quaternion.Euler(0, 0, 0);
                 pscript.state = player_superscript.State.S_STAND;
             }
             else if (pscript.fall_through)
                 pcollider.transform.collider2D.isTrigger = true;
         }
     }
 }
Ejemplo n.º 6
0
 void Update()
 {
     pscript = null;
     pcollider = null;
 }
Ejemplo n.º 7
0
 void Start()
 {
     pscript = null;
     pcollider = null;
 }
Ejemplo n.º 8
0
 void Update()
 {
     cscript = null;
     pscript = null;
 }
Ejemplo n.º 9
0
 void Start()
 {
     cscript = null;
     pscript = null;
 }
Ejemplo n.º 10
0
 void OnTriggerExit2D(Collider2D other)
 {
     cscript = other.gameObject.GetComponent<collider_script>();
     if (cscript != null && cscript.gameObject.name == "collider_box")
         cscript.transform.collider2D.isTrigger = false;
 }
Ejemplo n.º 11
0
 void Update()
 {
     cs = null;
     ps = null;
 }
Ejemplo n.º 12
0
 void Start()
 {
     cs = null;
     ps = null;
 }