コード例 #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Terrain"))
        {
            rb_unit.useGravity      = false;
            rb_unit.velocity        = Vector3.zero;
            rb_unit.angularVelocity = Vector3.zero;
            iMove = true;
            if (unit_ui == null)
            {
                unit_ui = player_controller.GetUnitUI(this);
            }
            else
            {
                unit_ui.position = new Vector3(transform.position.x, 0.2f, transform.position.z);
            }
        }

        if (other.CompareTag("Bullet"))
        {
            UnitTakeDamage((short)(Random.Range(15, 35)));
            game_controller.ReturnObjectInPool(other.GetComponent <Rigidbody>(), 0);
        }

        if (other.CompareTag("Flag") && current_zone != null)
        {
            current_zone.RefreshCaptureZone(this);
        }
    }