Ejemplo n.º 1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.LeftArrow))
     {
         hp.Decrease(1);
         hp.Commit();
     }
     if (Input.GetKeyDown(KeyCode.RightArrow))
     {
         hp.Increase(1);
         hp.Commit();
     }
     if (Input.GetKeyDown(KeyCode.X))
     {
         DoWeirdStuff();
     }
 }
Ejemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D _collider)
    {
        if (_collider.gameObject.tag == "TileMap" || _collider.gameObject.tag == "Libra")
        {
            b_JumpFlag = false;
        }

        if (_collider.gameObject.tag == "CameraMove")
        {
            b_CameraMoveFlag = true;
        }

        if (_collider.gameObject.tag == "CheckPoint")
        {
            v_PositionSave = _collider.gameObject.transform.position;
        }


        if (_collider.gameObject.tag == "EnemyAttack")
        {
            HpDecrease(5.0f);
        }

        if (_collider.gameObject.tag == "Fall")
        {
            int tmp = 1;
            if ((transform.position.x - v_PositionSave.x) > 0)
            {
                tmp *= -1;
            }
            transform.position = new Vector3(v_PositionSave.x, v_PositionSave.y, 0.0f);

            b_CameraMoveFlag = true;

            g_HP.Decrease(100.0f);
            GameObject director = GameObject.Find("HPDirector");
            director.GetComponent <HPDirector>().DecreaseHP(g_HP.GetHp(), cf_HPMax);
            g_right2D.AddForce(transform.right * -10.0f);
        }
    }